You are here

public function EdgeEntityAliasConfigFormBase::submitForm in Apigee Edge 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 ConfigFormBase::submitForm

File

src/Form/EdgeEntityAliasConfigFormBase.php, line 63

Class

EdgeEntityAliasConfigFormBase
Base form for those Apigee Edge entities that supports aliasing.

Namespace

Drupal\apigee_edge\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config($this
    ->getConfigNameWithLabels());
  if ($config
    ->get('entity_label_singular') !== $form_state
    ->getValue('entity_label_singular') || $config
    ->get('entity_label_plural') !== $form_state
    ->getValue('entity_label_plural')) {
    $config
      ->set('entity_label_singular', $form_state
      ->getValue('entity_label_singular'))
      ->set('entity_label_plural', $form_state
      ->getValue('entity_label_plural'))
      ->save();

    // An entity label could be cached in multiple places so let's clear
    // all caches.
    drupal_flush_all_caches();
  }
  parent::submitForm($form, $form_state);
}