Merge pull request #68 from NobrainerWeb/master

Make the setEmptyString configurable
This commit is contained in:
Marcus 2015-07-27 19:49:41 +10:00
commit bb6748e414
2 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
name: gridfieldextensions
---
GridFieldAddNewMultiClass:
showEmptyString: true

View File

@ -11,6 +11,9 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
'handleAdd'
);
// Should we add an empty string to the add class dropdown?
private static $showEmptyString = true;
private $fragment;
private $title;
@ -155,7 +158,9 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
GridFieldExtensions::include_requirements();
$field = new DropdownField(sprintf('%s[ClassName]', __CLASS__), '', $classes);
if (Config::inst()->get('GridFieldAddNewMultiClass', 'showEmptyString')) {
$field->setEmptyString(_t('GridFieldExtensions.SELECTTYPETOCREATE', '(Select type to create)'));
}
$field->addExtraClass('no-change-track');
$data = new ArrayData(array(