Set form container classes via PHP API
authorMatthias Schmidt <gravatronics@live.com>
Sun, 24 Feb 2019 13:36:18 +0000 (14:36 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 24 Feb 2019 13:36:18 +0000 (14:36 +0100)
This way, the default classes can also be removed again

See #2509

12 files changed:
com.woltlab.wcf/templates/__formContainer.tpl
com.woltlab.wcf/templates/__tabFormContainer.tpl
com.woltlab.wcf/templates/__tabMenuFormContainer.tpl
com.woltlab.wcf/templates/__tabTabMenuFormContainer.tpl
wcfsetup/install/files/acp/templates/__formContainer.tpl
wcfsetup/install/files/acp/templates/__tabFormContainer.tpl
wcfsetup/install/files/acp/templates/__tabMenuFormContainer.tpl
wcfsetup/install/files/acp/templates/__tabTabMenuFormContainer.tpl
wcfsetup/install/files/lib/system/form/builder/container/FormContainer.class.php
wcfsetup/install/files/lib/system/form/builder/container/TabFormContainer.class.php
wcfsetup/install/files/lib/system/form/builder/container/TabMenuFormContainer.class.php
wcfsetup/install/files/lib/system/form/builder/container/TabTabMenuFormContainer.class.php

index 9a1a0bee2205db1594e9da71a5d5bc33ed264732..1bc1bbc95657cf6b83b4abdc172e2bfac71e7727 100644 (file)
@@ -1,4 +1,8 @@
-<section id="{@$container->getPrefixedId()}Container" class="section{foreach from=$container->getClasses() item='class'} {$class}{/foreach}"{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{if !$container->checkDependencies()} style="display: none;"{/if}>
+<section id="{@$container->getPrefixedId()}Container"{*
+       *}{if !$container->getClasses()|empty}class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}" {/if}{*
+       *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
+       *}{if !$container->checkDependencies()} style="display: none;"{/if}{*
+*}>
        {if $container->getLabel() !== null}
                {if $container->getDescription() !== null}
                        <header class="sectionHeader">
index 179eadff14241fcd9f5ccaed1c811ac0a9404f34..b7e12b038f82800c6cb3a2ababf47ea2d1e2453d 100644 (file)
@@ -1,4 +1,8 @@
-<div id="{@$container->getPrefixedId()}Container" class="tabMenuContent{foreach from=$container->getClasses() item='class'} {$class}{/foreach}"{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{if !$container->checkDependencies()} style="display: none;"{/if}>
+<div id="{@$container->getPrefixedId()}Container"{*
+       *}{if !$container->getClasses()|empty}class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}" {/if}{*
+       *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
+       *}{if !$container->checkDependencies()} style="display: none;"{/if}{*
+*}>
        {include file='__formContainerChildren'}
 </div>
 
index f8f3e15b805c4bbfd99c43b9f503e7305d3ab2d8..8b349ccee5cd9bc9667abc99d7f980d3b1837867 100644 (file)
@@ -1,4 +1,8 @@
-<div id="{@$container->getPrefixedId()}Container" class="section tabMenuContainer{foreach from=$container->getClasses() item='class'} {$class}{/foreach}"{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{if !$container->checkDependencies()} style="display: none;"{/if}{if !$container->checkDependencies()} style="display: none;"{/if}>
+<div id="{@$container->getPrefixedId()}Container" {*
+       *}{if !$container->getClasses()|empty}class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}" {/if}{*
+       *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
+       *}{if !$container->checkDependencies()} style="display: none;"{/if}{*
+*}>
        <nav class="tabMenu">
                <ul>
                        {foreach from=$container item='child'}
index a181463413feafaabfe4e9327d2d7478ca344f0a..2db5b317beb56e8c6b59d932bef94470fa3b6650 100644 (file)
@@ -1,4 +1,7 @@
-<div id="{@$container->getPrefixedId()}Container" class="tabMenuContainer tabMenuContent{foreach from=$container->getClasses() item='class'} {$class}{/foreach}"{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}>
+<div id="{@$container->getPrefixedId()}Container" {*
+       *}{if !$container->getClasses()|empty}class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}" {/if}{*
+       *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
+*}>
        <nav class="menu">
                <ul>
                        {foreach from=$container item='child'}
index 9a1a0bee2205db1594e9da71a5d5bc33ed264732..1bc1bbc95657cf6b83b4abdc172e2bfac71e7727 100644 (file)
@@ -1,4 +1,8 @@
-<section id="{@$container->getPrefixedId()}Container" class="section{foreach from=$container->getClasses() item='class'} {$class}{/foreach}"{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{if !$container->checkDependencies()} style="display: none;"{/if}>
+<section id="{@$container->getPrefixedId()}Container"{*
+       *}{if !$container->getClasses()|empty}class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}" {/if}{*
+       *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
+       *}{if !$container->checkDependencies()} style="display: none;"{/if}{*
+*}>
        {if $container->getLabel() !== null}
                {if $container->getDescription() !== null}
                        <header class="sectionHeader">
index 179eadff14241fcd9f5ccaed1c811ac0a9404f34..b7e12b038f82800c6cb3a2ababf47ea2d1e2453d 100644 (file)
@@ -1,4 +1,8 @@
-<div id="{@$container->getPrefixedId()}Container" class="tabMenuContent{foreach from=$container->getClasses() item='class'} {$class}{/foreach}"{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{if !$container->checkDependencies()} style="display: none;"{/if}>
+<div id="{@$container->getPrefixedId()}Container"{*
+       *}{if !$container->getClasses()|empty}class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}" {/if}{*
+       *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
+       *}{if !$container->checkDependencies()} style="display: none;"{/if}{*
+*}>
        {include file='__formContainerChildren'}
 </div>
 
index f8f3e15b805c4bbfd99c43b9f503e7305d3ab2d8..8b349ccee5cd9bc9667abc99d7f980d3b1837867 100644 (file)
@@ -1,4 +1,8 @@
-<div id="{@$container->getPrefixedId()}Container" class="section tabMenuContainer{foreach from=$container->getClasses() item='class'} {$class}{/foreach}"{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{if !$container->checkDependencies()} style="display: none;"{/if}{if !$container->checkDependencies()} style="display: none;"{/if}>
+<div id="{@$container->getPrefixedId()}Container" {*
+       *}{if !$container->getClasses()|empty}class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}" {/if}{*
+       *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
+       *}{if !$container->checkDependencies()} style="display: none;"{/if}{*
+*}>
        <nav class="tabMenu">
                <ul>
                        {foreach from=$container item='child'}
index a181463413feafaabfe4e9327d2d7478ca344f0a..2db5b317beb56e8c6b59d932bef94470fa3b6650 100644 (file)
@@ -1,4 +1,7 @@
-<div id="{@$container->getPrefixedId()}Container" class="tabMenuContainer tabMenuContent{foreach from=$container->getClasses() item='class'} {$class}{/foreach}"{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}>
+<div id="{@$container->getPrefixedId()}Container" {*
+       *}{if !$container->getClasses()|empty}class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}" {/if}{*
+       *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
+*}>
        <nav class="menu">
                <ul>
                        {foreach from=$container item='child'}
index ae9d6d22833a0f70462eca31c0d129eb746a8d6b..35fd43f87ab06f3171a3cbc27c4f3d78358c7d87 100644 (file)
@@ -31,6 +31,13 @@ class FormContainer implements IFormContainer {
         */
        protected $templateName = '__formContainer';
        
+       /**
+        * @inheritDoc
+        */
+       public function __construct() {
+               $this->addClass('section');
+       }
+       
        /**
         * @inheritDoc
         */
index 484440acfeb20fdb965fedd9b44eb18a785f2947..93c0a680d96eb41f4b3180fbce4bfb6682ca59f5 100644 (file)
@@ -15,4 +15,11 @@ class TabFormContainer extends FormContainer implements ITabFormContainer {
         * @inheritDoc
         */
        protected $templateName = '__tabFormContainer';
+       
+       /**
+        * @inheritDoc
+        */
+       public function __construct() {
+               $this->addClass('tabMenuContent');
+       }
 }
index 6e466177062696d4a7a1e085c027cb026f045647..29d506fbe4d79eb5c8f28670a6c8d546b5a6e578 100644 (file)
@@ -15,4 +15,12 @@ class TabMenuFormContainer extends FormContainer implements ITabMenuFormContaine
         * @inheritDoc
         */
        protected $templateName = '__tabMenuFormContainer';
+       
+       /**
+        * @inheritDoc
+        */
+       public function __construct() {
+               $this->addClass('section')
+                       ->addClass('tabMenuContainer');
+       }
 }
index 763afdddb5922f60d38078cf36c4d0c2a1334355..bde3e0ec5d9df61be23806e9e4c3dcc6d4301a98 100644 (file)
@@ -10,9 +10,16 @@ namespace wcf\system\form\builder\container;
  * @package    WoltLabSuite\Core\System\Form\Builder\Container
  * @since      5.2
  */
-class TabTabMenuFormContainer extends FormContainer implements ITabFormContainer, ITabMenuFormContainer {
+class TabTabMenuFormContainer extends TabMenuFormContainer implements ITabFormContainer {
        /**
         * @inheritDoc
         */
-       protected $templateName = '__formTabTabMenuContainer';
+       protected $templateName = '__tabTabMenuFormContainer';
+       
+       /**
+        * @inheritDoc
+        */
+       public function __construct() {
+               $this->addClass('tabMenuContainer')->addClass('tabMenuContent');
+       }
 }