From: Matthias Schmidt Date: Sat, 5 Oct 2019 14:48:58 +0000 (+0200) Subject: Add `RowFormFieldContainer` X-Git-Tag: 5.2.0_Beta_2~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=345d927388ee7812104ab769a26388f6d65cd583;p=GitHub%2FWoltLab%2FWCF.git Add `RowFormFieldContainer` Close #3086 --- diff --git a/com.woltlab.wcf/templates/__rowFormFieldContainer.tpl b/com.woltlab.wcf/templates/__rowFormFieldContainer.tpl new file mode 100644 index 0000000000..cb5582611e --- /dev/null +++ b/com.woltlab.wcf/templates/__rowFormFieldContainer.tpl @@ -0,0 +1,33 @@ +
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}
+
+
+ {foreach from=$container item='field'} + {if $field->isAvailable()} +
getClasses()|empty} class="{implode from=$field->getClasses() item='class' glue=' '}{$class}{/implode}"{/if}{foreach from=$field->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{if !$field->checkDependencies()} style="display: none;"{/if}> + {@$field->getFieldHtml()} + + {include file='__formFieldErrors'} + {include file='__formFieldDependencies'} + {include file='__formFieldDataHandler'} +
+ {/if} + {/foreach} +
+ {if $container->getDescription() !== null} + {@$container->getDescription()} + {/if} +
+
+ +{include file='__formContainerDependencies'} + + diff --git a/wcfsetup/install/files/acp/templates/__rowFormFieldContainer.tpl b/wcfsetup/install/files/acp/templates/__rowFormFieldContainer.tpl new file mode 100644 index 0000000000..cb5582611e --- /dev/null +++ b/wcfsetup/install/files/acp/templates/__rowFormFieldContainer.tpl @@ -0,0 +1,33 @@ +
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}
+
+
+ {foreach from=$container item='field'} + {if $field->isAvailable()} +
getClasses()|empty} class="{implode from=$field->getClasses() item='class' glue=' '}{$class}{/implode}"{/if}{foreach from=$field->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{if !$field->checkDependencies()} style="display: none;"{/if}> + {@$field->getFieldHtml()} + + {include file='__formFieldErrors'} + {include file='__formFieldDependencies'} + {include file='__formFieldDataHandler'} +
+ {/if} + {/foreach} +
+ {if $container->getDescription() !== null} + {@$container->getDescription()} + {/if} +
+
+ +{include file='__formContainerDependencies'} + + diff --git a/wcfsetup/install/files/lib/system/form/builder/container/RowFormFieldContainer.class.php b/wcfsetup/install/files/lib/system/form/builder/container/RowFormFieldContainer.class.php new file mode 100644 index 0000000000..e5463fe507 --- /dev/null +++ b/wcfsetup/install/files/lib/system/form/builder/container/RowFormFieldContainer.class.php @@ -0,0 +1,42 @@ + + * @package WoltLabSuite\Core\System\Form\Builder\Container + * @since 5.2 + */ +class RowFormFieldContainer extends FormContainer { + /** + * @inheritDoc + */ + protected $templateName = '__rowFormFieldContainer'; + + /** + * @inheritDoc + */ + public function __construct() { + // does nothing + } + + /** + * @inheritDoc + */ + public function appendChild(IFormChildNode $child) { + if ((!$child instanceof IFormField)) { + throw new \InvalidArgumentException("'" . static::class . "' only supports '" . IFormField::class . "' instances as children."); + } + + return parent::appendChild($child); + } +}