Skip to content

Commit dec994e

Browse files
Fix bug
1 parent 1dbe81c commit dec994e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Fields/FormField.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ public function __construct($name, $type, Form $parent, array|Arrayable $options
122122
$this->parent = $parent;
123123
$this->formHelper = $this->parent->getFormHelper();
124124
$this->setTemplate();
125+
126+
if ($options instanceof Arrayable) {
127+
$options = $options->toArray();
128+
}
129+
125130
$this->setDefaultOptions($options);
126131
$this->setupValue();
127132
$this->initFilters();
@@ -159,7 +164,7 @@ abstract protected function getTemplate();
159164
*
160165
* @param array $options
161166
*/
162-
protected function setDefaultOptions(array|Arrayable $options = [])
167+
protected function setDefaultOptions(array $options = [])
163168
{
164169
$this->options = $this->formHelper->mergeOptions($this->allDefaults(), $this->getDefaults());
165170
$this->options = $this->prepareOptions($options);
@@ -213,7 +218,7 @@ protected function getDefaults()
213218
* @param array $options
214219
* @return array The parsed options
215220
*/
216-
protected function prepareOptions(array|Arrayable $options = [])
221+
protected function prepareOptions(array $options = [])
217222
{
218223
$helper = $this->formHelper;
219224

@@ -436,7 +441,7 @@ protected function transformKey($key)
436441
* @param array $options
437442
* @return array
438443
*/
439-
protected function setDefaultClasses(array|Arrayable $options = [])
444+
protected function setDefaultClasses(array $options = [])
440445
{
441446
$wrapper_class = $this->getConfig('defaults.' . $this->type . '.wrapper_class', '');
442447
$label_class = $this->getConfig('defaults.' . $this->type . '.label_class', '');

0 commit comments

Comments
 (0)