Skip to content

Commit

Permalink
Merge pull request #245 from gordonbanderson/ISSUE_243
Browse files Browse the repository at this point in the history
FIX: Fix to allow use of foreign text as tags and categories.  Fixes …
  • Loading branch information
assertchris committed Jun 3, 2015
2 parents 83673d9 + 7c8bd69 commit 1b7c312
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 @@ -802,9 +802,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 @@ -843,9 +848,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 1b7c312

Please sign in to comment.