This commit is contained in:
Sam Georges 2014-06-08 18:07:56 +10:00
parent ef2234c74b
commit c044e63a07

View File

@ -357,6 +357,26 @@ class Form extends WidgetBase
$field->arrayName = $this->arrayName; $field->arrayName = $this->arrayName;
$field->idPrefix = $this->getId(); $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 * Process basic options
*/ */
@ -381,25 +401,6 @@ class Form extends WidgetBase
*/ */
$field->value = $this->getFieldValue($field); $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 * Widget with options
*/ */