From: Matthias Schmidt Date: Sun, 14 Dec 2014 10:28:52 +0000 (+0100) Subject: Add checkboxes option type X-Git-Tag: 2.1.0_Beta_1~14 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f23c2cdf608db777f7e557a26da13292202856db;p=GitHub%2FWoltLab%2FWCF.git Add checkboxes option type --- 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); } /**