You are here

public function PageVariantBreadcrumbsForm::submitForm in Panels Breadcrumbs 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/PageVariantBreadcrumbsForm.php, line 82

Class

PageVariantBreadcrumbsForm
Class PageVariantBreadcrumbsForm.

Namespace

Drupal\panels_breadcrumbs\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $cached_values = $form_state
    ->getTemporaryValue('wizard');
  $page_variant = $cached_values['page_variant'];
  $variant_settings = $page_variant
    ->get('variant_settings');
  $submitted_values = $form_state
    ->getValues();
  foreach ($this
    ->getSettingsKeys() as $name) {
    $variant_settings['panels_breadcrumbs'][$name] = $submitted_values[$name];
  }
  $page_variant
    ->set('variant_settings', $variant_settings);

  // Invalidate breadcrumbs block cache.
  $theme_name = \Drupal::config('system.theme')
    ->get('default');
  Cache::invalidateTags([
    "config:block.block.{$theme_name}_breadcrumbs",
  ]);
}