Use indented template group select list in `StyleAddForm`
authorFabii547 <Fabii547@users.noreply.github.com>
Sat, 14 Mar 2020 10:00:03 +0000 (11:00 +0100)
committerFabii547 <Fabii547@users.noreply.github.com>
Sat, 14 Mar 2020 10:03:45 +0000 (11:03 +0100)
wcfsetup/install/files/acp/templates/styleAdd.tpl
wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php

index 1b240fe994db894da14d836b0fd0ac4b2a3fd159..93b8f8b8ee0940702591a6c6df339da2da6d5b78 100644 (file)
                                                <dd>
                                                        <select name="templateGroupID" id="templateGroupID">
                                                                <option value="0">{lang}wcf.acp.template.group.default{/lang}</option>
-                                                               {foreach from=$availableTemplateGroups item=templateGroup}
-                                                                       <option value="{@$templateGroup->templateGroupID}"{if $templateGroup->templateGroupID == $templateGroupID} selected{/if}>{$templateGroup->getName()}</option>
-                                                               {/foreach}
+                                                               {htmlOptions options=$availableTemplateGroups selected=$templateGroupID disableEncoding=true}
                                                        </select>
                                                        {if $errorField == 'templateGroupID'}
                                                                <small class="innerError">
index 0f8e20924b3c8ac373159584ef509417cf82b060..15ffa0d0494b1e106f329098bd7730355fd15f66 100644 (file)
@@ -5,7 +5,6 @@ use wcf\data\style\Style;
 use wcf\data\style\StyleAction;
 use wcf\data\style\StyleEditor;
 use wcf\data\template\group\TemplateGroup;
-use wcf\data\template\group\TemplateGroupList;
 use wcf\form\AbstractForm;
 use wcf\system\event\EventHandler;
 use wcf\system\exception\SystemException;
@@ -213,11 +212,7 @@ class StyleAddForm extends AbstractForm {
                        $this->readStyleVariables();
                }
                
-               $templateGroupList = new TemplateGroupList();
-               $templateGroupList->sqlOrderBy = "templateGroupName";
-               $templateGroupList->getConditionBuilder()->add('templateGroupFolderName <> ?', ['_wcf_email/']);
-               $templateGroupList->readObjects();
-               $this->availableTemplateGroups = $templateGroupList->getObjects();
+               $this->availableTemplateGroups = TemplateGroup::getSelectList([-1], 1);
                
                if (isset($_REQUEST['tmpHash'])) {
                        $this->tmpHash = StringUtil::trim($_REQUEST['tmpHash']);