Skip to content

My media should add menu items via hooks / callbacks NOT by touching $CFG->customusermenuitems / $CFG->custommenuitems #463

@brendanheywood

Description

@brendanheywood

This code here is wrong:

https://github.com/kaltura/moodle_plugin/blob/MOODLE_405_DEV/local/mymedia/lib.php#L77-L84

This mutates the config, which means if you view the settings page for those you see the dynamic variables. If you then save them they are permanently added. If you then change the kaltura settings for local_mymedia link_location then you will end up with duplicate menu items.

Instead these should be added via hooks:

core\hook\navigation\primary_extend
core\hook\navigation\secondary_extend
core_user\hook\extend_user_menu

On top of this link_location should have an option for not inserting the link anywhere, this way you can manage the position of the link manually in other places, eg in theme settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions