Added hook to open external menu links in new tab
This commit is contained in:
parent
c28e048db0
commit
588b159dbd
@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user