public function WebformHorizontalRule::form in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElement/WebformHorizontalRule.php \Drupal\webform\Plugin\WebformElement\WebformHorizontalRule::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 WebformElementBase::form
File
- src/
Plugin/ WebformElement/ WebformHorizontalRule.php, line 107
Class
- WebformHorizontalRule
- Provides a 'webform_horizontal_rule' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['horizontal_rule'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Horizontal rule settings'),
];
$form['horizontal_rule']['display_on'] = [
'#type' => 'select',
'#title' => $this
->t('Display on'),
'#options' => $this
->getDisplayOnOptions(),
];
$form['horizontal_rule_attributes'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Horizontal rule attributes'),
];
$form['horizontal_rule_attributes']['attributes'] = [
'#type' => 'webform_element_attributes',
'#title' => $this
->t('Horizontal rule'),
'#classes' => $this->configFactory
->get('webform.settings')
->get('element.horizontal_rule_classes'),
];
unset($form['element_attributes']['attributes']);
return $form;
}