*}type="{if $field->supportsTime()}datetime{else}date{/if}" {*
*}id="{@$field->getPrefixedId()}" {*
*}name="{@$field->getPrefixedId()}" {*
- *}value="{$field->getValue()}" {*
- *}class="medium"{*
+ *}value="{$field->getValue()}"{*
+ *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
*}{if $field->isAutofocused()} autofocus{/if}{*
*}{if $field->isRequired()} required{/if}{*
*}{if $field->isImmutable()} disabled{/if}{*
*}type="{if $field->supportsTime()}datetime{else}date{/if}" {*
*}id="{@$field->getPrefixedId()}" {*
*}name="{@$field->getPrefixedId()}" {*
- *}value="{$field->getValue()}" {*
- *}class="medium"{*
+ *}value="{$field->getValue()}"{*
+ *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
*}{if $field->isAutofocused()} autofocus{/if}{*
*}{if $field->isRequired()} required{/if}{*
*}{if $field->isImmutable()} disabled{/if}{*
* @package WoltLabSuite\Core\System\Form\Builder\Field
* @since 5.2
*/
-class DateFormField extends AbstractFormField implements IAutoFocusFormField, IImmutableFormField, INullableFormField {
+class DateFormField extends AbstractFormField implements IAutoFocusFormField, ICssClassFormField, IImmutableFormField, INullableFormField {
use TAutoFocusFormField;
+ use TCssClassFormField;
use TImmutableFormField;
use TNullableFormField;
const DATE_FORMAT = 'Y-m-d';
const TIME_FORMAT = 'Y-m-d\TH:i:sP';
+ /**
+ * Creates a new instance of `DateFormField`.
+ */
+ public function __construct() {
+ $this->addFieldClass('medium');
+ }
+
/**
* Sets the earliest valid date in `DateFormField::$saveValueFormat` format and returns this
* field. If `null` is given, the previously set earliest valid date is unset.