Skip to content

Commit

Permalink
FIX: Fixing default string creator.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkRoberts committed Feb 7, 2017
1 parent 8417f81 commit 6417875
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions code/AdvancedDropdownField.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ class AdvancedDropdownField extends DropDownField {
public function Field($properties = array()) {
$source = $this->getSource();
$options = array();

if ($this->getHasEmptyDefault()) {
$selected = ($this->value === '' || $this->value === null);
$disabled = (in_array('', $this->disabledItems, true)) ? 'disabled' : false;
$empty = $this->getEmptyString();
$options[] = new ArrayData(array(
'Value' => '',
'Title' => $empty['Title'],
'Selected' => $selected,
'Disabled' => $disabled,
'Attributes' => $this->createOptionAttributes($empty)
));
}

if($source) {
// SQLMap needs this to add an empty value to the options
if(is_object($source) && $this->emptyString) {
$options[] = new ArrayData(array(
'Value' => '',
'Title' => $this->emptyString,
));
}

foreach($source as $value => $params) {


Expand Down

0 comments on commit 6417875

Please sign in to comment.