Add RowFormContainer
authorMatthias Schmidt <gravatronics@live.com>
Sat, 5 Oct 2019 12:20:38 +0000 (14:20 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 5 Oct 2019 12:20:38 +0000 (14:20 +0200)
Close #3084

com.woltlab.wcf/templates/__rowFormContainer.tpl [new file with mode: 0644]
wcfsetup/install/files/acp/templates/__rowFormContainer.tpl [new file with mode: 0644]
wcfsetup/install/files/lib/system/form/builder/container/RowFormContainer.class.php [new file with mode: 0644]

diff --git a/com.woltlab.wcf/templates/__rowFormContainer.tpl b/com.woltlab.wcf/templates/__rowFormContainer.tpl
new file mode 100644 (file)
index 0000000..26e58e3
--- /dev/null
@@ -0,0 +1,15 @@
+<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>
+
+{include file='__formContainerDependencies'}
+
+<script data-relocate="true">
+       require(['WoltLabSuite/Core/Form/Builder/Field/Dependency/Container/Default'], function(DefaultContainerDependency) {
+               new DefaultContainerDependency('{@$container->getPrefixedId()}Container');
+       });
+</script>
diff --git a/wcfsetup/install/files/acp/templates/__rowFormContainer.tpl b/wcfsetup/install/files/acp/templates/__rowFormContainer.tpl
new file mode 100644 (file)
index 0000000..26e58e3
--- /dev/null
@@ -0,0 +1,15 @@
+<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>
+
+{include file='__formContainerDependencies'}
+
+<script data-relocate="true">
+       require(['WoltLabSuite/Core/Form/Builder/Field/Dependency/Container/Default'], function(DefaultContainerDependency) {
+               new DefaultContainerDependency('{@$container->getPrefixedId()}Container');
+       });
+</script>
diff --git a/wcfsetup/install/files/lib/system/form/builder/container/RowFormContainer.class.php b/wcfsetup/install/files/lib/system/form/builder/container/RowFormContainer.class.php
new file mode 100644 (file)
index 0000000..cf6bce1
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+namespace wcf\system\form\builder\container;
+
+/**
+ * Represents a form container whose children are displayed in rows.
+ * 
+ * While objects of this class support setting (and getting) labels and descriptions, they are not
+ * shown in the actual form!
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2019 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\System\Form\Builder\Container
+ * @since      5.2
+ */
+class RowFormContainer extends FormContainer {
+       /**
+        * @inheritDoc
+        */
+       protected $templateName = '__rowFormContainer';
+       
+       /**
+        * @inheritDoc
+        */
+       public function __construct() {
+               $this->addClasses(['row', 'rowColGap', 'formGrid']);
+       }
+}