You are here

public function ApiDocSettingsForm::submitForm in Apigee API Catalog 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Entity/Form/ApiDocSettingsForm.php, line 70

Class

ApiDocSettingsForm
Class ApiDocSettingsForm.

Namespace

Drupal\apigee_api_catalog\Entity\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $entity_type = $this->entityTypeManager
    ->getStorage('apidoc')
    ->getEntityType();
  $config = $this
    ->configFactory()
    ->getEditable(static::CONFIG_NAME);
  $options = $form_state
    ->getValue('options');
  $config
    ->set('default_revision', (bool) $options['new_revision'])
    ->save();
  $this
    ->messenger()
    ->addStatus($this
    ->t('@type settings have been updated.', [
    '@type' => $entity_type
      ->getLabel(),
  ]));
}