-
Improvement
-
Resolution: Won't Do
-
Minor
-
None
-
2.9
-
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:
- cminfo->jsaction
- cminfo->jsactionargs
- 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.
- will help resolve
-
MDL-50446 Main menu block throws javascript fatal error if there is a resource to be opened in a new window
-
- Closed
-