diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index bfe618b1c..7ca905fd6 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -357,6 +357,26 @@ class Form extends WidgetBase $field->arrayName = $this->arrayName; $field->idPrefix = $this->getId(); + /* + * Simple widget field, only widget type is supplied + */ + if (is_string($config) && $this->isFormWidget($config) !== false) { + $field->displayAs('widget', ['widget' => $config]); + return $field; + } + /* + * Simple field, only field type is supplied + */ + elseif (is_string($config)) { + $field->displayAs($config); + return $field; + } + + + $fieldType = isset($config['type']) ? $config['type'] : null; + if (!is_string($fieldType) && !is_null($fieldType)) + throw new ApplicationException(Lang::get('backend::lang.field.invalid_type', ['type'=>gettype($fieldType)])); + /* * Process basic options */ @@ -381,25 +401,6 @@ class Form extends WidgetBase */ $field->value = $this->getFieldValue($field); - /* - * Simple widget field, only widget type is supplied - */ - if (is_string($config) && $this->isFormWidget($config) !== false) { - $field->displayAs('widget', ['widget' => $config]); - return $field; - } - /* - * Simple field, only field type is supplied - */ - elseif (is_string($config)) { - $field->displayAs($config); - return $field; - } - - $fieldType = isset($config['type']) ? $config['type'] : null; - if (!is_string($fieldType) && !is_null($fieldType)) - throw new ApplicationException(Lang::get('backend::lang.field.invalid_type', ['type'=>gettype($fieldType)])); - /* * Widget with options */