You are here

public function SettingsForm::buildForm in Lightning API 8

Same name and namespace in other branches
  1. 8.4 src/Form/SettingsForm.php \Drupal\lightning_api\Form\SettingsForm::buildForm()
  2. 8.2 src/Form/SettingsForm.php \Drupal\lightning_api\Form\SettingsForm::buildForm()
  3. 8.3 src/Form/SettingsForm.php \Drupal\lightning_api\Form\SettingsForm::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/SettingsForm.php, line 30

Class

SettingsForm
The settings form for controlling Content API's behavior.

Namespace

Drupal\lightning_api\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('lightning_api.settings');
  $form['entity_json'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Expose a "View JSON" link in entity operations'),
    '#default_value' => $config
      ->get('entity_json'),
  ];
  $form['bundle_docs'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Expose a "View API Documentation" link in bundle entity operations'),
    '#default_value' => $config
      ->get('bundle_docs'),
  ];
  return parent::buildForm($form, $form_state);
}