mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
FIX: Fix to allow use of foreign text as tags and categories. Fixes #243
This commit is contained in:
parent
17832fd942
commit
7c8bd693f2
@ -803,9 +803,14 @@ class Blog_Controller extends Page_Controller {
|
|||||||
*/
|
*/
|
||||||
$dataRecord = $this->dataRecord;
|
$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()
|
return $dataRecord->Tags()
|
||||||
->filter('URLSegment', $tag)
|
->filter('URLSegment', $tag)
|
||||||
->first();
|
->first();
|
||||||
@ -844,9 +849,12 @@ class Blog_Controller extends Page_Controller {
|
|||||||
*/
|
*/
|
||||||
$dataRecord = $this->dataRecord;
|
$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()
|
return $dataRecord->Categories()
|
||||||
->filter('URLSegment', $category)
|
->filter('URLSegment', $category)
|
||||||
->first();
|
->first();
|
||||||
|
Loading…
Reference in New Issue
Block a user