mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Merge pull request #245 from gordonbanderson/ISSUE_243
FIX: Fix to allow use of foreign text as tags and categories. Fixes …
This commit is contained in:
commit
1b7c312eb1
@ -802,9 +802,14 @@ class Blog_Controller extends Page_Controller {
|
||||
*/
|
||||
$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();
|
||||
@ -843,9 +848,12 @@ class Blog_Controller extends Page_Controller {
|
||||
*/
|
||||
$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();
|
||||
|
Loading…
Reference in New Issue
Block a user