From f137a0223664bacf467c1e7db20ae0d3d415ea28 Mon Sep 17 00:00:00 2001 From: Jan Kristinus Date: Tue, 4 Sep 2018 13:01:09 +0200 Subject: [PATCH] choice Felder Abfrage verbessert --- lib/yform/value/choice.php | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/yform/value/choice.php b/lib/yform/value/choice.php index 97233177..9f856880 100644 --- a/lib/yform/value/choice.php +++ b/lib/yform/value/choice.php @@ -205,13 +205,13 @@ public static function getListValues($params) $field = $params['params']['field']; $choiceList = self::createChoiceList([ - 'choice_attributes' => @$field['choice_attributes'], - 'choices' => @$field['choices'], - 'expanded' => @$field['expanded'], - 'group_by' => @$field['group_by'], - 'multiple' => @$field['multiple'], - 'placeholder' => @$field['placeholder'], - 'preferred_choices' => @$field['preferred_choices'], + 'choice_attributes' => (isset($field['choice_attributes'])) ? $field['choice_attributes'] : '', + 'choices' => (isset($field['choices'])) ? $field['choices'] : [], + 'expanded' => (isset($field['expanded'])) ? $field['expanded'] : '', + 'group_by' => (isset($field['group_by'])) ? $field['group_by'] : '', + 'multiple' => (isset($field['multiple'])) ? $field['multiple'] : false, + 'placeholder' => (isset($field['placeholder'])) ? $field['placeholder'] : '', + 'preferred_choices' => (isset($field['preferred_choices'])) ? $field['preferred_choices'] : [], ]); $choices = $choiceList->getChoicesByValues(); @@ -249,16 +249,17 @@ public function getAttributes($element, array $attributes = [], array $directAtt public static function getSearchField($params) { + $choiceList = self::createChoiceList([ - 'choice_attributes' => @$params['field']['choice_attributes'], - 'choices' => @$params['field']['choices'], - 'expanded' => @$params['field']['expanded'], - 'group_by' => @$params['field']['group_by'], - 'multiple' => @$params['field']['multiple'], - 'placeholder' => @$params['field']['placeholder'], - 'preferred_choices' => @$params['field']['preferred_choices'], + 'choice_attributes' => (isset($params['field']['choice_attributes'])) ? $params['field']['choice_attributes'] : '', + 'choices' => (isset($params['field']['choices'])) ? $params['field']['choices'] : [], + 'expanded' => (isset($params['field']['expanded'])) ? $params['field']['expanded'] : '', + 'group_by' => (isset($params['field']['group_by'])) ? $params['field']['group_by'] : '', + 'multiple' => (isset($params['field']['multiple'])) ? $params['field']['multiple'] : false, + 'placeholder' => (isset($params['field']['placeholder'])) ? $params['field']['placeholder'] : '', + 'preferred_choices' => (isset($params['field']['preferred_choices'])) ? $params['field']['preferred_choices'] : [], ]); - + $choices = []; $choices['(empty)'] = '(empty)'; $choices['!(empty)'] = '!(empty)';