mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-06-29 07:59:37 +02:00
FEATURE: Enable switch between legacy image search and new version
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@106178 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
8b82347453
commit
af428a9bf2
|
@ -9,6 +9,15 @@
|
||||||
class ThumbnailStripField extends FormField {
|
class ThumbnailStripField extends FormField {
|
||||||
protected $parentField;
|
protected $parentField;
|
||||||
protected $updateMethod;
|
protected $updateMethod;
|
||||||
|
|
||||||
|
protected static $use_legacy_image_search = false;
|
||||||
|
|
||||||
|
public static function set_use_legacy_image_search($enable) {
|
||||||
|
self::$use_legacy_image_search = $enable;
|
||||||
|
}
|
||||||
|
public static function get_use_legacy_image_search() {
|
||||||
|
return self::$use_legacy_image_search;
|
||||||
|
}
|
||||||
|
|
||||||
function __construct($name, $parentField, $updateMethod = "getimages") {
|
function __construct($name, $parentField, $updateMethod = "getimages") {
|
||||||
$this->parentField = $parentField;
|
$this->parentField = $parentField;
|
||||||
|
@ -52,9 +61,13 @@ class ThumbnailStripField extends FormField {
|
||||||
$images = DataObject::get('Image', $whereSQL, 'Title');
|
$images = DataObject::get('Image', $whereSQL, 'Title');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$whereSQL = "\"ParentID\" = 0";
|
if (!self::$use_legacy_image_search) {
|
||||||
|
$whereSQL = "\"ParentID\" = 0 AND ";
|
||||||
|
} else {
|
||||||
|
$whereSQL = '';
|
||||||
|
}
|
||||||
if($searchText) {
|
if($searchText) {
|
||||||
$whereSQL .= " AND \"Filename\" LIKE '%$searchText%'";
|
$whereSQL .= " \"Filename\" LIKE '%$searchText%'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$images = DataObject::get('Image', $whereSQL, 'Title');
|
$images = DataObject::get('Image', $whereSQL, 'Title');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user