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

Deprecate cminfo->onclick

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 2.9
    • Course, JavaScript
    • MOODLE_29_STABLE
    • Moderate

      The HTML onclick attribute is a thing of the past and should be banished from our lands.

      I propose that we replace the cminfo->onclick with:

      1. cminfo->jsaction
      2. cminfo->jsactionargs
      3. cminfo->jsamdmodule (optional)

      These will fill the data-attributes of the anchor:

      $args = array(
          'data-action' => $cminfo->jsaction,
          'data-actionargs' => $cminfo->jsactionargs,
      );
       
      static $loaded = array();
      if ($cminfo->jsamdmodule) {
          if (!isset($loaded[$cminfo->jsamdmodule])) {
              $PAGE->requires->js_call_amd($cminfo->jsamdmodule, 'setup');
              $loaded[$cminfo->jsamdmodule]) = true;
          }
      }
      

      Or something to this effect. We can also add an amdmodule which watches for all action=popup and grabs the arguments for them to create a popup.

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

              Created:
              Updated:
              Resolved:

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