From 0aef151d9a73555209d43ede12be4ad059b0deae Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Fri, 25 Mar 2016 18:21:58 +1100 Subject: [PATCH] Add showSearch option to dropdown This is a highly specific option, so we shouldn't add it to the FormField class itself --- modules/backend/classes/FormField.php | 11 +++++++++++ .../backend/widgets/form/partials/_field_dropdown.htm | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/backend/classes/FormField.php b/modules/backend/classes/FormField.php index 2bb2275fa..6428904f2 100644 --- a/modules/backend/classes/FormField.php +++ b/modules/backend/classes/FormField.php @@ -548,6 +548,17 @@ class FormField return HtmlHelper::nameToId($id); } + /** + * Returns a raw config item value. + * @param string $value + * @param string $default + * @return mixed + */ + public function getConfig($value, $default = null) + { + return array_get($this->config, $value, $default); + } + /** * Returns this fields value from a supplied data set, which can be * an array or a model or another generic collection. diff --git a/modules/backend/widgets/form/partials/_field_dropdown.htm b/modules/backend/widgets/form/partials/_field_dropdown.htm index 46fac9464..75476e00c 100644 --- a/modules/backend/widgets/form/partials/_field_dropdown.htm +++ b/modules/backend/widgets/form/partials/_field_dropdown.htm @@ -1,5 +1,6 @@ options(); + $useSearch = $field->getConfig('showSearch', true); ?> previewMode): ?> @@ -8,7 +9,7 @@