You are here

public function AddAnotherSettingsForm::buildForm in Add Another 8

Form constructor.

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 The form structure.

Overrides ConfigFormBase::buildForm

File

src/Form/AddAnotherSettingsForm.php, line 30

Class

AddAnotherSettingsForm
Configure Add another settings for this site.

Namespace

Drupal\addanother\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('addanother.settings');
  $form['addanother_display'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Default settings for newly created content types'),
  ];
  $form['addanother_display']['default_button'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable <i>Display Add another button on node add form</i> for new content types.'),
    '#default_value' => $config
      ->get('default_button'),
  ];
  $form['addanother_display']['default_message'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable <i>Display the Add another message after node creation</i> for new content types.'),
    '#default_value' => $config
      ->get('default_message'),
  ];
  $form['addanother_display']['default_tab'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable <i>Display the Add another tab</i> for new content types.'),
    '#default_value' => $config
      ->get('default_tab'),
  ];
  $form['addanother_display']['default_tab_edit'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable <i>Also display the Add another tab on edit page</i> for new content types.'),
    '#default_value' => $config
      ->get('default_tab_edit'),
  ];
  return parent::buildForm($form, $form_state);
}