diff --git a/modules/backend/formwidgets/TagList.php b/modules/backend/formwidgets/TagList.php index b0f594f99..0ec1d4102 100644 --- a/modules/backend/formwidgets/TagList.php +++ b/modules/backend/formwidgets/TagList.php @@ -42,6 +42,11 @@ class TagList extends FormWidgetBase */ public $nameFrom = 'name'; + /** + * @var bool Use the key instead of value for saving and reading data. + */ + public $useKey = false; + // // Object properties // @@ -62,6 +67,7 @@ class TagList extends FormWidgetBase 'options', 'mode', 'nameFrom', + 'useKey', ]); } @@ -71,6 +77,7 @@ class TagList extends FormWidgetBase public function render() { $this->prepareVars(); + return $this->makePartial('taglist'); } @@ -79,6 +86,7 @@ class TagList extends FormWidgetBase */ public function prepareVars() { + $this->vars['useKey'] = $this->useKey; $this->vars['field'] = $this->formField; $this->vars['fieldOptions'] = $this->getFieldOptions(); $this->vars['selectedValues'] = $this->getLoadValue(); diff --git a/modules/backend/formwidgets/taglist/partials/_taglist.htm b/modules/backend/formwidgets/taglist/partials/_taglist.htm index 667d74a7c..c34a6f443 100644 --- a/modules/backend/formwidgets/taglist/partials/_taglist.htm +++ b/modules/backend/formwidgets/taglist/partials/_taglist.htm @@ -1,6 +1,6 @@