Form field "preset" options can be a string that just specifies the other field, defaults to url type

This commit is contained in:
Samuel Georges 2015-03-07 11:02:16 +11:00
parent 477ce7bbc7
commit 69542c311c
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,6 @@
* **Build 21x** (2015-03-xx)
- Form fields can now use a simpler interface for using the Input preset converter (see Backend > Forms docs).
* **Build 217** (2015-03-06)
- Improvements made to the user menu in the back-end: clicking your avatar will display a popover with settings links from the `mysettings` context.
- Added new form field widget called `repeater` for repeatable fields (see Backend > Forms docs).

View File

@ -435,9 +435,13 @@ class FormField
*/
protected function filterPresetAttributes($attributes, $position = 'field')
{
if (!$this->preset || !is_array($this->preset) || $position != 'field')
if (!$this->preset || $position != 'field')
return $attributes;
if (!is_array($this->preset)) {
$this->preset = ['field' => $this->preset, 'type' => 'slug'];
}
$presetField = array_get($this->preset, 'field');
$presetType = array_get($this->preset, 'type');