You are here

protected function ModuleBuilderComponentFormBase::elementBoolean in Module Builder 7.2

Set form element properties specific to boolean component properties.

Parameters

&$element: The form element for the component property.

FormStateInterface $form_state: The form state.

$property_info: The info array for the component property.

$form_default_value: The default value for the form element.

Return value

string The handling type to be applied to this element's value on submit.

File

includes/module_builder.form.inc, line 370

Class

ModuleBuilderComponentFormBase
Backport of ComponentFormBase from 8.x-3.x version.

Code

protected function elementBoolean(&$element, FormStateInterface $form_state, $property_info, $form_default_value) {
  $element['#type'] = 'checkbox';
  $element['#default_value'] = $form_default_value;
  return 'checkbox';
}