Search callback for "add page" selector

Necessary since we now default $showSearch=true in TreeDropdownField.
See https://github.com/silverstripe/silverstripe-framework/pull/2364
This commit is contained in:
Ingo Schommer 2013-08-29 17:08:25 +02:00
parent cdb4ab4fbc
commit 4e031076be

View File

@ -81,6 +81,16 @@ class CMSPageAddController extends CMSPageEditController {
)
)
);
$parentField->setSearchFunction(function ($sourceObject, $labelField, $search) {
return DataObject::get(
$sourceObject,
sprintf(
"\"MenuTitle\" LIKE '%%%s%%' OR \"Title\" LIKE '%%%s%%'",
Convert::raw2sql($search),
Convert::raw2sql($search)
)
);
});
// TODO Re-enable search once it allows for HTML title display,
// see http://open.silverstripe.org/ticket/7455