Set unique name for AddNewMultiClass Selects

fixing wrong behaviour when having multiple Gridfields containing AddNewMultiClass Selects on one form
This commit is contained in:
Felix Eggmann 2017-04-13 14:59:54 +02:00 committed by Marcus Nyeholt
parent e62422fdb3
commit 5c1f9cca01

View File

@ -188,7 +188,8 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
GridFieldExtensions::include_requirements();
$field = new DropdownField(sprintf('%s[ClassName]', __CLASS__), '', $classes, $this->defaultClass);
$field = new DropdownField(sprintf('%s[%s]', __CLASS__, $grid->getName()), '', $classes, $this->defaultClass);
if (Config::inst()->get('GridFieldAddNewMultiClass', 'showEmptyString')) {
$field->setEmptyString(_t('GridFieldExtensions.SELECTTYPETOCREATE', '(Select type to create)'));
}