You are here

function page_manager_update_8401 in Page Manager 8.4

Add "redirect_location" key to all "http_status_code" page variant.

File

./page_manager.install, line 62
Contains update functions for Page Manager.

Code

function page_manager_update_8401() {
  $names = \Drupal::configFactory()
    ->listAll('page_manager.page_variant');
  foreach ($names as $name) {
    $config = \Drupal::configFactory()
      ->getEditable($name);
    if ($config
      ->get('variant') === 'http_status_code') {
      $variant_settings = $config
        ->get('variant_settings');
      if (!array_key_exists('redirect_location', $variant_settings)) {
        $config
          ->set('variant_settings.redirect_location', '');
        $config
          ->save();
      }
    }
  }
}