Skip to content

Commit

Permalink
úprava pro addDynamicSelect a addDynamicMultiSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
Honza Nováček committed Jul 15, 2016
1 parent 01b2b42 commit b5926cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Components/AjaxSelect/Traits/InvalidSetValueTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function setValue($value) {
} catch (\Nette\InvalidArgumentException $e) {}

// make sure $value is an array
if ($this instanceof AjaxSelect\Interfaces\IMultiSelectControl && !is_array($value)) {
if (!is_array($value)) {
$value = [ $value ];
}

Expand Down
4 changes: 4 additions & 0 deletions src/Components/AjaxSelect/Traits/ItemFactoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ protected function processValues($values) {
return $this->handleInvalidValues($values);
}

if (!$this instanceof AjaxSelect\Interfaces\IMultiSelectControl && is_array($values)) {
$values = reset($values);
}

$item = call_user_func($this->itemFactory, $values);

if (empty($item)) {
Expand Down

0 comments on commit b5926cf

Please sign in to comment.