Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-41069

M.core.actionmenu does not register to coursebase

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.6
    • JavaScript
    • MOODLE_26_STABLE

      I've just noticed that the new actionmenu:
      #) is not a course module
      #) does not register to course base.

      It seems that in order to make it work on new activities (either through drag/drop, or some other means), we call M.core.actionmenu.newDOMNode(newcm); (or something similar).

      We already have a invocation wrapper to do this for us so that any third-party developers writing some code who want to apply all of the course JS to their code when they set up a new activity via JS can do so - I'm thinking of things like mod_subpage for example.

      This is present in coursebase.

      In order to use it, we need to create a new course-specific actionmenu which extends moodle-core-actionmenu, defines any of the relevant functions, and calls the corresponding moodle-core-actionmenu function.
      In this case, we need it to define a function called register_new_module.

      Admittedly this is underdocumented - it's not been moved to Shifter yet, and so we haven't added any API docs. Also, it should ideally be converted to a custom event which bubbles globally so that any module can hook into it, and any module can call the event, but for the moment we should use the existing infrastructure.

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.