By pielgrzym on
Hi there,
is there a way to make Drupal not filter html special characters from menu names? I need to put a non breaking space in one of menu items, yet I don't want to create a static template-hardcoded menu. Unfortunately Drupal keeps translating the ' ', so item names look like this "my humble page 1" :(
I'd be gratefull for some help :)
Comments
Drupal keeps translating the
Drupal keeps translating the "& nbsp ;" :)
Hello. i am no expert but
Hello.
i am no expert but while digging through the handbook and API i managed to create custom menu for my site.
please refer to the following discussion: http://drupal.org/node/107821
there is a lot to read through, but i can assure you that you can ignore most of it. pay close attention to the menu_item.tpl.php and template.php that calls that menu_item.
by using custom menu_item you can define ANY kind of menu you wish.
if you have further questions i'd be happy to answer them.
Sometimes something interesting appears on http://litwol.com
Not working. Is it possible
Not working. Is it possible in Drupal 7?
HTML in the menu title
You should take a look at Menu HTML module: http://drupal.org/project/menu_html
Ive found menu html to be
Ive found menu html to be quite buggy. Are their any other module solutions?
I had no trouble with the
I had no trouble with the menu html module. Although, I was just implementing a simple line break and then making it pretty with CSS.
It's super simple. Add this
It's super simple. Add this to your template.php:
replace YOURTHEMENAME with your theme name.
This is Drupal 7 core function theme_link() and I just added option $variables['options']['html'] = TRUE; and that's it.
Sasha
Print & Screen
yup! thanks! this did it
yup! thanks! this did it perfectly
Excelent
PERFECT!! function with superfish too
The function worked perfectly
The function worked perfectly and no need to add yet another module. Adding this function to my template.php, I was able to put an html non-breaking space ( ) in my menu tabs titles. Thanks xalexas.
ReggieW
extend this to book-navigation
Thank you for that.
How can I extend it to also affect the links in book-navigation?
The links in the navigation menu (sidebar) show the formatted text, but not the ones that are provided by book-navigation.tpl.php (under the book page).
This module can help
http://drupal.org/project/menu_attributes
or this
http://drupal.org/project/menu_html (Does not have a stable D7 branch)
Solution for Drupal 8
For Drupal 8 your link title must be a instance of MarkupInterface.
You can rewrite your menu link like this :
Hi mixalis44,
Hi mixalis44,
I'm trying for the same in drupal8. Should this change be done in the customtheme.theme in the below function ?
This is how it looks :
Adding your code here gives me an 500 internal server error. Appreciate any help on this.
Your solution works like
Your solution works like charm!
where to put?
Hi Kaelfaz, could please explain me where do I have to insert the function YOUTHEME...?
thanks
I would like to allow html
I would like to allow html into a link-field. How should I customise the code?
sub menus
What if you have sub menus (children) of primary menu links? This should work for this case:
Replace your theme name with the YOURTHEME.
Hope it helps
If you have multi-level menu
If you have multi-level menu use this