You are here

protected function LayoutChangeSettings::setCachedValues in Panels 8.3

Same name and namespace in other branches
  1. 8.4 src/Form/LayoutChangeSettings.php \Drupal\panels\Form\LayoutChangeSettings::setCachedValues()

Sets the appropriate cached values for the layout settings.

Depending upon the next step, this form could be required to properly update the values of the PanelsDisplayVariant plugin in the cached values or it could just be adding the configuration to the cached values directly. This bit of logic is repeated a number of times in the form submission, and so abstracting it is typical DRY approach.

Parameters

string $next_step: The next step of the wizard.

\Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant $plugin: The plugin to update.

\Drupal\layout_plugin\Plugin\Layout\LayoutInterface $layout: The layout for which we are upating settings.

array $cached_values: The current cached values from the wizard.

array $configuration: The new configuration of the layout.

Return value

mixed Returns the new cached values.

1 call to LayoutChangeSettings::setCachedValues()
LayoutChangeSettings::submitForm in src/Form/LayoutChangeSettings.php
Form submission handler.

File

src/Form/LayoutChangeSettings.php, line 175

Class

LayoutChangeSettings
Provides a form for configuring a layout's settings.

Namespace

Drupal\panels\Form

Code

protected function setCachedValues($next_step, PanelsDisplayVariant $plugin, LayoutInterface $layout, $cached_values, $configuration) {

  // The step is modified by various wizards but will end in "regions"
  if (substr($next_step, 0 - 7) == 'regions') {
    $cached_values['layout_change']['layout_settings'] = $configuration;
  }
  else {
    $plugin
      ->setLayout($layout, $configuration);
    $cached_values['plugin'] = $plugin;
    unset($cached_values['layout_change']);
  }
  return $cached_values;
}