Merge branch '4.6' into 4

This commit is contained in:
Maxime Rainville 2020-10-22 13:33:16 +13:00
commit fd2184e7d1
5 changed files with 26 additions and 3 deletions

View File

@ -5,6 +5,7 @@ namespace SilverStripe\CMS\Controllers;
use SilverStripe\Admin\LeftAndMain_SearchFilter;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Convert;
use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Forms\DateField;
use SilverStripe\ORM\DataList;
@ -203,13 +204,19 @@ abstract class CMSSiteTreeFilter implements LeftAndMain_SearchFilter
switch ($name) {
case 'Term':
$query = $query->filterAny([
'URLSegment:PartialMatch' => $val,
'URLSegment:PartialMatch' => Convert::raw2url($val),
'Title:PartialMatch' => $val,
'MenuTitle:PartialMatch' => $val,
'Content:PartialMatch' => $val
]);
break;
case 'URLSegment':
$query = $query->filter([
'URLSegment:PartialMatch' => Convert::raw2url($val),
]);
break;
case 'LastEditedFrom':
$fromDate = new DateField(null, null, $val);
$query = $query->filter("LastEdited:GreaterThanOrEqual", $fromDate->dataValue().' 00:00:00');

View File

@ -326,6 +326,8 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
private static $runCMSFieldsExtensions = true;
/**
* Deleting this page also deletes all its children when set to true.
*
* @config
* @var boolean
*/
@ -2101,7 +2103,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
->setRightTitle(
_t(
'SilverStripe\\CMS\\Model\\SiteTree.METAEXTRAHELP',
"HTML tags for additional meta information. For example <meta name=\"customName\" content=\"your custom content here\" />"
"HTML tags for additional meta information. For example <meta name=\"customName\" content=\"your custom content here\">"
)
)
->addExtraClass('help');

View File

@ -215,7 +215,7 @@ en:
METADESC: 'Meta Description'
METADESCHELP: 'Search engines use this content for displaying search results (although it will not influence their ranking).'
METAEXTRA: 'Custom Meta Tags'
METAEXTRAHELP: 'HTML tags for additional meta information. For example <meta name="customName" content="your custom content here" />'
METAEXTRAHELP: 'HTML tags for additional meta information. For example <meta name="customName" content="your custom content here">'
MODIFIEDONDRAFTHELP: 'Page has unpublished changes'
MODIFIEDONDRAFTSHORT: Modified
MetadataToggle: Metadata

View File

@ -47,6 +47,17 @@ class CMSSiteTreeFilterTest extends SapphireTest
);
}
public function testUrlSegmentFilter()
{
$page = $this->objFromFixture(Page::class, 'page8');
$filter = CMSSiteTreeFilter_Search::create(['Term' => 'lake-wanaka+adventure']);
$this->assertTrue($filter->isPageIncluded($page));
$filter = CMSSiteTreeFilter_Search::create(['URLSegment' => 'lake-wanaka+adventure']);
$this->assertTrue($filter->isPageIncluded($page));
}
public function testIncludesParentsForNestedMatches()
{
$parent = $this->objFromFixture('Page', 'page3');

View File

@ -29,3 +29,6 @@ Page:
page3b:
Parent: =>Page.page3
Title: Page 3b
page8:
Title: EncodedUrlSegment
URLSegment: lake-wanaka+adventure