You are here

public function WebformSection::form in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/WebformSection.php \Drupal\webform\Plugin\WebformElement\WebformSection::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 ContainerBase::form

File

src/Plugin/WebformElement/WebformSection.php, line 63

Class

WebformSection
Provides a 'section' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['form']['title_tag'] = [
    '#type' => 'webform_select_other',
    '#title' => $this
      ->t('Title tag'),
    '#description' => $this
      ->t("The section's title HTML tag."),
    '#options' => [
      'h1' => $this
        ->t('Header 1 (h1)'),
      'h2' => $this
        ->t('Header 2 (h2)'),
      'h3' => $this
        ->t('Header 3 (h3)'),
      'h4' => $this
        ->t('Header 4 (h4)'),
      'h5' => $this
        ->t('Header 5 (h5)'),
      'h6' => $this
        ->t('Header 6 (h6)'),
      'label' => $this
        ->t('Label (label)'),
    ],
  ];

  // Remove unsupported description display.
  unset($form['form']['display_container']['description_display']['#options']['tooltip']);
  return $form;
}