mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX If DropdownField->Field() lack of source checking before looping through it
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64320 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5865fd19d1
commit
972558df3f
@ -70,20 +70,22 @@ class DropdownField extends FormField {
|
||||
$options = '';
|
||||
|
||||
$source = $this->getSource();
|
||||
foreach($source as $value => $title) {
|
||||
$selected = ($value == $this->value) ? 'selected' : null;
|
||||
if($selected && $this->value != 0) {
|
||||
$this->isSelected = true;
|
||||
if($source) {
|
||||
foreach($source as $value => $title) {
|
||||
$selected = ($value == $this->value) ? 'selected' : null;
|
||||
if($selected && $this->value != 0) {
|
||||
$this->isSelected = true;
|
||||
}
|
||||
|
||||
$options .= $this->createTag(
|
||||
'option',
|
||||
array(
|
||||
'selected' => $selected,
|
||||
'value' => $value
|
||||
),
|
||||
$title
|
||||
);
|
||||
}
|
||||
|
||||
$options .= $this->createTag(
|
||||
'option',
|
||||
array(
|
||||
'selected' => $selected,
|
||||
'value' => $value
|
||||
),
|
||||
$title
|
||||
);
|
||||
}
|
||||
|
||||
$attributes = array(
|
||||
|
Loading…
Reference in New Issue
Block a user