You are here

function _views_update_argument_map in Drupal 8

Builds an argument map for each Views display.

Parameters

array $displays: A list of Views displays.

Return value

array The argument map keyed by display id.

1 call to _views_update_argument_map()
views_update_8002 in core/modules/views/views.install
Updates %1 and !1 tokens to argument tokens.

File

core/modules/views/views.install, line 289
Contains install and update functions for Views.

Code

function _views_update_argument_map($displays) {
  $argument_map = [];
  foreach ($displays as $display_id => $display) {
    $argument_map[$display_id] = [];
    if (isset($display['display_options']['arguments'])) {
      foreach (array_keys($display['display_options']['arguments']) as $number => $name) {
        $argument_map[$display_id][$number + 1] = $name;
      }
    }
    elseif (isset($displays['default']['display_options']['arguments'])) {
      foreach (array_keys($displays['default']['display_options']['arguments']) as $number => $name) {
        $argument_map[$display_id][$number + 1] = $name;
      }
    }
  }
  return $argument_map;
}