silverstripe/silverstripe-framework — pull request #2516 by nathanbrauer (2013-10-09 23:21:59+00:00)
Title: Fix bug: DropdownField::create(...)->setHasEmptyDefault(true) was not effective

Found this bug when upgrading to 3.1.

Our original code in `Page.php` (which should work on any standard CMS setup):
```
$fields->addFieldTotab('Root.Metadata',DropdownField::create("AuthorID",'Author', ArrayList::create(DataList::create('Member'))->map('ID','AuthorName'))->setHasEmptyDefault(true));
```

Was updated to:
```
$fields->addFieldTotab('Root.Metadata',DropdownField::create("AuthorID",'Author', DataList::create('Member')->map('ID','AuthorName'))->setHasEmptyDefault(true));
```

The only difference is using ArrayList instead of DataList (working around a bug in 3.0).

I tracked down the bug to `DropdownField.php` where it was checking `$this->emptyString` instead of `$this->getHasEmptyDefault()`.