Close

Adding menu items using widgets

Oakstone
9 years ago
#7421 Quote
Avatar
  • 29
I want to create custom menu items that are editable in the admin area. This way we do not need update code when users want to add items. I've added a widget zone in SupportWidgetZones.xml and added the zone in MegaMenu.cshtml. I've created the widget and it appears in the menu.

The issue is the that tinymce autocorrects the HTML. For example
<li><a href="mylink">my link text</a></li>
is converted to
<ul>
li><a href="mylink">my link text</a></li>
</ul>

Any thoughts on how to turn off the autocorrect or how to add a widget as a menu item correctly?

Thanks.
Deni
9 years ago
#7429 Quote
Avatar
  • Moderator
  • 389
Oakstone wrote:
I want to create custom menu items that are editable in the admin area. This way we do not need update code when users want to add items. I've added a widget zone in SupportWidgetZones.xml and added the zone in MegaMenu.cshtml. I've created the widget and it appears in the menu.

The issue is the that tinymce autocorrects the HTML. For example
<li><a href="mylink">my link text</a></li>
is converted to
<ul>
li><a href="mylink">my link text</a></li>
</ul>

Any thoughts on how to turn off the autocorrect or how to add a widget as a menu item correctly?

Thanks.



Hello,

This is how the TinyMce works and we can not avoid it.

I suggest you to use another tag, then a <li> and style it with the same properties.

Another variant is to call the new widgets inside the <li> tag and in the editor must have only a link. For example:

<li>@Html.Widget("my_custom_link")</li>


I hope that helped you.

Best Regards,
Mladen Staykov

Best Regards,
Mladen Staykov
Nop-Templates.com