Skip to content

Instantly share code, notes, and snippets.

@jacine
Last active July 6, 2016 21:50
Show Gist options
  • Save jacine/bc48f1ccf004b2d84e54ae6b4193ea8a to your computer and use it in GitHub Desktop.
Save jacine/bc48f1ccf004b2d84e54ae6b4193ea8a to your computer and use it in GitHub Desktop.
Give me my HTML in my Drupal 8 menu links!
<?php
/**
* Implements hook_preprocess_menu().
*/
function THEME_preprocess_menu(&$vars, $hook) {
if ($hook == 'menu__account') {
$items = $vars['items'];
foreach ($items as $key => $item) {
if ($key == 'user.page') {
$vars['items'][$key]['title'] = array(
'#markup' => 'Log the <i>fuck</i> in!',
'#allowed_tags' => array('i'),
);
}
if ($key == 'user.logout') {
$vars['items'][$key]['title'] = array(
'#markup' => 'Log the <i>fuck</i> out!',
'#allowed_tags' => array('i'),
);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment