You are here

public function BaseFieldConfigFromBase::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 FormInterface::submitForm

File

src/Form/BaseFieldConfigFromBase.php, line 140

Class

BaseFieldConfigFromBase
Base form for configuring base fields on Apigee Edge entities.

Namespace

Drupal\apigee_edge\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $required_base_fields = [];
  foreach ($form_state
    ->getValue('table') as $name => $data) {
    if ($data['required']) {
      $required_base_fields[] = $name;
    }
  }
  $this
    ->saveRequiredBaseFields($required_base_fields);

  // Let's clear every cache not just base field definitions for safety.
  drupal_flush_all_caches();
  $this
    ->messenger()
    ->addStatus($this
    ->t('Field settings have been saved successfully.'));
}