Added hook to open external menu links in new tab

This commit is contained in:
naomi 2018-05-07 18:31:24 +02:00
parent c28e048db0
commit 588b159dbd

View File

@ -7,6 +7,18 @@
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_link_alter
*
* Makes menu items that are external links open in new tab.
*/
function opencase_link_alter(&$variables) {
if ($variables['url']->isExternal()) {
$variables['options']['attributes'] = ['target' => '_blank'];
}
}
/**
* Implements hook_preprocess_page_title
*