You are here

private function FormRoute::bumpKeys in Drupal 7 to 8/9 Module Upgrader 8

Returns a copy of the input array with the keys increased by $offset. This only works on numerically indexed arrays; I don't know what it does to associative arrays, but probably nothing good.

Parameters

array $input: The input array.

int $offset: The offset to add to the keys.

Return value

array

1 call to FormRoute::bumpKeys()
FormRoute::buildParameterMap in src/Plugin/DMU/Routing/FormRoute.php
Builds a parameter map from the aggregated arguments of the title, access, and page callbacks.

File

src/Plugin/DMU/Routing/FormRoute.php, line 77

Class

FormRoute
Plugin annotation @Converter( id = "drupal_get_form", description = @Translation("Converts a drupal_get_form() menu item to a _form route."), dependencies = { "router.route_provider", "plugin.manager.drupalmoduleupgrader.rewriter",…

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Routing

Code

private function bumpKeys(array $input, $offset = 0) {
  $output = [];
  foreach ($input as $key => $value) {
    $output[$key + $offset] = $value;
  }
  return $output;
}