FormControl
A single form control and its associated values, such as label and help text.
Classname
Photon\CmsEngine\Model\Element\FormControl
Attributes
Attribute | Type | Description |
---|---|---|
$id | integer | The id of this form control in the database, where the form is content managed |
$label | string | The label of the form control |
$options | array | An array of form control options, for example in a select or radio button group |
$name | string | The content of the name attribute of the form control's HTML element |
$value | string | The content of the value attribute of the form control's HTML element |
$type | string | The type of form control HTML element to use in the template |
$error | boolean | Whether validation found an error in this control |
$autocomplete | boolean | Whether the autocomplete attribute should be disabled for this control |
$disabled | boolean | Whether this control is disabled in the user interface |
$help | string | The help text to display with this form control |
$maxlength | integer | The content of the maxlength attribute of the form control's HTML element |
$mandatory | boolean | Whether this control must be completed prior to successful submission |
$className | string | Additional CSS class name data associated with this control |
$placeholder | string | The content of the placeholder attribute of the form control's HTML element |
<?php
use Photon\CmsEngine\Model\Element\FormControl;
$control = new FormControl();
$control->setLabel($passwordLabel);
$control->setName('password');
$control->setType('password');
$control->setValue('');
$control->setMandatory(true);
$control->setAutocomplete(false);