You are here

public function YamlFormWizardPage::form in YAML Form 8

Gets the actual configuration form 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 form without any default values..

Overrides YamlFormElementBase::form

File

src/Plugin/YamlFormElement/YamlFormWizardPage.php, line 63

Class

YamlFormWizardPage
Provides a 'yamlform_wizard_page' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);

  /** @var \Drupal\yamlform\YamlFormInterface $yamlform */
  $yamlform = $form_state
    ->getFormObject()
    ->getYamlForm();
  $form['wizard_page'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Page settings'),
  ];
  $form['wizard_page']['prev_button_label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Previous page button label'),
    '#description' => $this
      ->t('This is used for the Next Page button on the page before this page break.') . '<br/>' . $this
      ->t('Defaults to: %value', [
      '%value' => $this
        ->getDefaultSettings($yamlform, 'wizard_prev_button_label'),
    ]),
  ];
  $form['wizard_page']['next_button_label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Next page button label'),
    '#description' => $this
      ->t('This is used for the Previous Page button on the page after this page break.') . '<br/>' . $this
      ->t('Defaults to: %value', [
      '%value' => $this
        ->getDefaultSettings($yamlform, 'wizard_next_button_label'),
    ]),
  ];
  return $form;
}