public function Checkbox::form in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformElement/Checkbox.php \Drupal\webform\Plugin\WebformElement\Checkbox::form()
Gets the actual configuration webform array to be built.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array An associative array contain the element's configuration webform without any default values.
Overrides BooleanBase::form
2 calls to Checkbox::form()
- WebformSame::form in src/
Plugin/ WebformElement/ WebformSame.php - Gets the actual configuration webform array to be built.
- WebformTermsOfService::form in src/
Plugin/ WebformElement/ WebformTermsOfService.php - Gets the actual configuration webform array to be built.
2 methods override Checkbox::form()
- WebformSame::form in src/
Plugin/ WebformElement/ WebformSame.php - Gets the actual configuration webform array to be built.
- WebformTermsOfService::form in src/
Plugin/ WebformElement/ WebformTermsOfService.php - Gets the actual configuration webform array to be built.
File
- src/
Plugin/ WebformElement/ Checkbox.php, line 70
Class
- Checkbox
- Provides a 'checkbox' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['display']['exclude_empty'] = [
'#title' => $this
->t('Exclude unselected checkbox'),
'#type' => 'checkbox',
'#return_value' => TRUE,
];
return $form;
}