1.20.x layout.module layout_contextual_links_view_alter(&$element, $items)

Implements hook_contextual_links_view_alter()

File

modules/layout/layout.module, line 880
The Layout module creates pages and wraps existing pages in layouts.

Code

function layout_contextual_links_view_alter(&$element, $items) {
  // Convert the link to manage blocks to use a shortened URL that lands the
  // user on the overall layout edit screen with a modal opened, instead of the
  // path to the block edit page itself.
  $links = &$element['#links'];
  if (isset($links['layout-configure-redirect-'])) {
    if ($position = strpos($links['layout-configure-redirect-']['href'], '/configure-redirect')) {
      $last_slash = strrpos($links['layout-configure-redirect-']['href'], '/');
      $uuid = substr($links['layout-configure-redirect-']['href'], $last_slash + 1);
      $links['layout-configure-redirect-']['fragment'] = 'configure-block:' . $uuid;
    }
  }
}