FIX only use sethasemptydefault if exists.

Backport of #4672 with a slight rewrite incase of subclasses of the field.
This commit is contained in:
Cam Findlay 2015-10-20 12:39:04 +13:00
parent f5f2861dc5
commit c3641587a5

View File

@ -362,7 +362,9 @@ class DropdownField extends FormField {
*/
public function castedCopy($classOrCopy) {
$field = parent::castedCopy($classOrCopy);
$field->setHasEmptyDefault($this->getHasEmptyDefault());
if($field->hasMethod('setHasEmptyDefault')) {
$field->setHasEmptyDefault($this->getHasEmptyDefault());
}
return $field;
}
}