Skip to main content

FormControl

A single form control and its associated values, such as label and help text.

Classname

Photon\CmsEngine\Model\Element\FormControl

Attributes

AttributeTypeDescription
$idintegerThe id of this form control in the database, where the form is content managed
$labelstringThe label of the form control
$optionsarrayAn array of form control options, for example in a select or radio button group
$namestringThe content of the name attribute of the form control's HTML element
$valuestringThe content of the value attribute of the form control's HTML element
$typestringThe type of form control HTML element to use in the template
$errorbooleanWhether validation found an error in this control
$autocompletebooleanWhether the autocomplete attribute should be disabled for this control
$disabledbooleanWhether this control is disabled in the user interface
$helpstringThe help text to display with this form control
$maxlengthintegerThe content of the maxlength attribute of the form control's HTML element
$mandatorybooleanWhether this control must be completed prior to successful submission
$classNamestringAdditional CSS class name data associated with this control
$placeholderstringThe 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);