Last active
July 6, 2016 18:46
-
-
Save jacine/960a8460c48a8b592a78949a3d965d54 to your computer and use it in GitHub Desktop.
HTML in menu items D8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_preprocess_menu(). | |
*/ | |
function THEME_preprocess_menu(&$vars, $hook) { | |
if ($hook == 'menu__main') { | |
$items = $vars['items']; | |
foreach ($items as $key => $item) { | |
$original_title = $vars['items'][$key]['title']; | |
$vars['items'][$key]['title'] = array( | |
'#markup' => $original_title, | |
'#allowed_tags' => array('span', 'b', 'i'), | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment