Skip to content

Commit

Permalink
FIX: Fix to allow use of foreign text as tags and categories. Fixes #243
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonbanderson committed May 15, 2015
1 parent 17832fd commit 7c8bd69
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions code/model/Blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -803,9 +803,14 @@ public function getCurrentTag() {
*/
$dataRecord = $this->dataRecord;

$tag = $this->request->param('Tag');
// get the tag value and generate a URL Segment for it
// use the URL segment for searching
$tagvalue = $this->request->param('Tag');
if($tagvalue) {
$tempTag = new BlogTag();
$tempTag->Title = $tagvalue;
$tag = $tempTag->generateURLSegment();

if($tag) {
return $dataRecord->Tags()
->filter('URLSegment', $tag)
->first();
Expand Down Expand Up @@ -844,9 +849,12 @@ public function getCurrentCategory() {
*/
$dataRecord = $this->dataRecord;

$category = $this->request->param('Category');
$categoryValue = $this->request->param('Category');

if($category) {
if($categoryValue) {
$tempCategory = new BlogCategory();
$tempCategory->Title = $categoryValue;
$category = $tempCategory->generateURLSegment();
return $dataRecord->Categories()
->filter('URLSegment', $category)
->first();
Expand Down

0 comments on commit 7c8bd69

Please sign in to comment.