Skip to content

Possible bug in render_custom_menu_item #455

@juaneladio

Description

@juaneladio

When I was reviewing a bug in a Moodle installation with the Theme Elegance (that uses Theme Bootstrap), I noticed that a menu item was generated incorrectly.

Long story short: The text "Hola" appears as a class atribute.

<ul class="dropdown-menu "><li><a class="Hola" title="Hola" href="/moodle/message/index.php?user1=76&amp;user2=2"><img src="/moodle/theme/image.php/elegance/core/1501546512/u/f2" alt="Picture of User" title="Picture of User" class="userpicture defaultuserpic" width="35" height="35" /><span class="msg-body"><span class="msg-title"><span class="msg-sender">Admin: </span>Hola</span><span class="msg-time"><i class="icon-time"></i><span>11 mins 42 secs</span></span></a></ul>

Now imagine that the text "Hola" changes to a larger text ...

I think the bug is created by this line of code in Theme Bootstrap:

https://github.com/bmbrands/theme_bootstrap/blob/master/renderers/core_renderer.php#L144

And class should be empty at this point, because nothing guarantees that $menunode->get_title() will always be a CSS class.

$class = '';

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions