1

I was trying to print the menu item description under the menu name.

I add this into the menu.inc under bootstrap theme, where the function bootstrap_menu_link(array $variables) is:

if ($element['#original_link']['menu_name'] == "main-menu" && isset($element['#localized_options']['attributes']['title'])){
    $element['#title'] .="<br> " . $element['#localized_options']['attributes']['title'];
  }

my interface then showed something like product<br>LED Drivers as the menu item - the <br> tag is printed out directly. I looked at the source code, that area shows: &lt;br&gt; , so I then tried using &lt;br&gt; in the php string, but the source code showed &amp;lt;br&amp;gt; this time. How can I correctly insert html tag into $element['#title']?

  • Can you paste the whole function or at least the part that returns the value or constructs the <a> html? It should be possible just to pass in array('html' => TRUE) to the options of the url() function. – Beebee Jun 26 '13 at 14:49
3

You could check if where the call to the l() function is created (in the function mentioned: bootstrap_menu_link), the third parameter contains the following element in the array:

'html' => TRUE

This tells drupal to output the title of the link as html and not run it trough check_plain().

Also, I would create a custom theme based on the bootstrap theme and add my customization there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.