From f23c2cdf608db777f7e557a26da13292202856db Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 14 Dec 2014 11:28:52 +0100 Subject: [PATCH] Add checkboxes option type --- .../acp/templates/checkboxesOptionType.tpl | 3 +++ .../checkboxesSearchableOptionType.tpl | 19 +++++++++++++++ .../option/CheckboxesOptionType.class.php | 24 +++++++++++++++++++ .../option/MultiSelectOptionType.class.php | 16 +++++++++++-- 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 wcfsetup/install/files/acp/templates/checkboxesOptionType.tpl create mode 100644 wcfsetup/install/files/acp/templates/checkboxesSearchableOptionType.tpl create mode 100644 wcfsetup/install/files/lib/system/option/CheckboxesOptionType.class.php diff --git a/wcfsetup/install/files/acp/templates/checkboxesOptionType.tpl b/wcfsetup/install/files/acp/templates/checkboxesOptionType.tpl new file mode 100644 index 0000000000..62f6c3f37c --- /dev/null +++ b/wcfsetup/install/files/acp/templates/checkboxesOptionType.tpl @@ -0,0 +1,3 @@ +{foreach from=$selectOptions key=key item=selectOption} + +{/foreach} diff --git a/wcfsetup/install/files/acp/templates/checkboxesSearchableOptionType.tpl b/wcfsetup/install/files/acp/templates/checkboxesSearchableOptionType.tpl new file mode 100644 index 0000000000..3c88d945b9 --- /dev/null +++ b/wcfsetup/install/files/acp/templates/checkboxesSearchableOptionType.tpl @@ -0,0 +1,19 @@ + +{foreach from=$selectOptions key=key item=selectOption} + +{/foreach} + + diff --git a/wcfsetup/install/files/lib/system/option/CheckboxesOptionType.class.php b/wcfsetup/install/files/lib/system/option/CheckboxesOptionType.class.php new file mode 100644 index 0000000000..026720c208 --- /dev/null +++ b/wcfsetup/install/files/lib/system/option/CheckboxesOptionType.class.php @@ -0,0 +1,24 @@ + + * @package com.woltlab.wcf + * @subpackage system.option + * @category Community Framework + */ +class CheckboxesOptionType extends MultiSelectOptionType { + /** + * @see \wcf\wcf\system\option\MultiSelectOptionType::$formElementTemplate + */ + protected $formElementTemplate = 'checkboxesOptionType'; + + /** + * @see \wcf\wcf\system\option\MultiSelectOptionType::$formElementTemplate + */ + protected $searchableFormElementTemplate = 'checkboxesSearchableOptionType'; +} diff --git a/wcfsetup/install/files/lib/system/option/MultiSelectOptionType.class.php b/wcfsetup/install/files/lib/system/option/MultiSelectOptionType.class.php index 65231a4f85..7e9efe2b93 100644 --- a/wcfsetup/install/files/lib/system/option/MultiSelectOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/MultiSelectOptionType.class.php @@ -19,6 +19,18 @@ use wcf\util\ArrayUtil; * @category Community Framework */ class MultiSelectOptionType extends SelectOptionType { + /** + * name of the form element template + * @var string + */ + protected $formElementTemplate = 'multiSelectOptionType'; + + /** + * name of the searchable form element template + * @var string + */ + protected $searchableFormElementTemplate = 'multiSelectSearchableOptionType'; + /** * @see \wcf\system\option\IOptionType::getFormElement() */ @@ -28,7 +40,7 @@ class MultiSelectOptionType extends SelectOptionType { 'selectOptions' => $this->getSelectOptions($option), 'value' => (!is_array($value) ? explode("\n", $value) : $value) )); - return WCF::getTPL()->fetch('multiSelectOptionType'); + return WCF::getTPL()->fetch($this->formElementTemplate); } /** @@ -41,7 +53,7 @@ class MultiSelectOptionType extends SelectOptionType { 'selectOptions' => $this->getSelectOptions($option), 'value' => (!is_array($value) ? explode("\n", $value) : $value) )); - return WCF::getTPL()->fetch('multiSelectSearchableOptionType'); + return WCF::getTPL()->fetch($this->searchableFormElementTemplate); } /** -- 2.20.1