HTML break tag in menu link

Created on 7 October 2019, over 4 years ago
Updated 17 March 2024, 3 months ago

Is there a way to use the <br> tag in a menu title? Currently it just prints out the <br> tag.

Thank you.

✨ Feature request
Status

Active

Version

1.0

Component

User interface

Created by

πŸ‡¨πŸ‡¦Canada AvO WebWorks Ottawa, Ontario, Canada

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡ͺBelgium hansrossel

    In a custom module:

    function MODULENAME_preprocess_superfish_menu_items(array &$variables) {

    .... copy everything the first part of the function from superfish.theme.inc ....

    $attributes = $item_attributes->__toString();
    $menu_item_title = (string) $item['text'];
    $menu_item_url = $item['url']->toString();
    $link_element = '' . $menu_item_title . '';;
    $link_element_menuparent = '' . $menu_item_title . '';;

    $variables['menu_items'][] = [

    .... copy the last part of the function from superfish.theme.inc ....
    }

    Copy superfish-menu-items.html.twig to your theme and add raw to the output of the menu links

    {% if item.children is not empty %}
    {{ item.link_menuparent|raw }}
    {% else %}
    {{ item.link|raw }}
    {% endif %}

Production build 0.69.0 2024