You are here

public function PrevnextSettingsForm::buildForm in Prevnext 2.0.x

Same name and namespace in other branches
  1. 8 src/Form/PrevnextSettingsForm.php \Drupal\prevnext\Form\PrevnextSettingsForm::buildForm()
  2. 2.x src/Form/PrevnextSettingsForm.php \Drupal\prevnext\Form\PrevnextSettingsForm::buildForm()

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/PrevnextSettingsForm.php, line 32

Class

PrevnextSettingsForm
Class PrevnextSettingsForm.

Namespace

Drupal\prevnext\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('prevnext.settings');
  $form['prevnext_enabled_nodetypes'] = [
    '#title' => $this
      ->t('Enabled Node Types'),
    '#description' => $this
      ->t('Check node types enabled for Previous/Next'),
    '#type' => 'checkboxes',
    '#options' => node_type_get_names(),
    '#default_value' => !empty($config
      ->get('prevnext_enabled_nodetypes')) ? $config
      ->get('prevnext_enabled_nodetypes') : [],
  ];
  return parent::buildForm($form, $form_state);
}