Hi,
I'm currently making improvements to the Grid course format for accessibility in M2.5 to be back ported to M2.3 and M2.4. I'm using the YUI Gallery module 'gallery-event-nav-keys' from http://yuilibrary.com/gallery/show/event-nav-keys. I am incorporating it within the format because I want it to work when the Moodle install does not have access to the CDN. So, I looked at the 'yui_modules' method but its specification is:
public function yui_module($modules, $function, array $arguments = null, $galleryversion = null, $ondomready = false)
However the module has no 'init()' function and I did not want to add one and change the code, therefore I'm having to use:
$PAGE->requires->js('/course/format/grid/javascript/gridkeys.js'); -> https://github.com/gjb2048/moodle-courseformat_grid/blob/MOODLE_25_CONTRIB_3240/renderer.php#L147
Which then performs a 'use':
YUI().use('moodle-format_grid-galleryeventnavkeys',function(Y) -> https://github.com/gjb2048/moodle-courseformat_grid/blob/MOODLE_25_CONTRIB_3240/javascript/gridkeys.js#L28
And as you can see, I've had to change the name so that it can be found in the folder:
Now, I read up about YUI modules and Shifter on the developer docs and initially created the folder:
But that did not work, even after adding 'moodle-format_grid' frankenstyle prefix which I thought was required.
Ok , what I would like to know please is if I'm doing it correctly or is there a better way?
Thanks,
Gareth
P.S. The documentation pages I read were:
http://docs.moodle.org/dev/Javascript/Shifter and http://docs.moodle.org/dev/JavaScript_guidelines, hence seeing that I needed the frankenstyle prefix.
P.P.S. As this is such a useful module, would it be considered for distribution in core? It makes the task of capturing key presses on a page a doddle so that 'Enter', 'TAB' and 'Shift-TAB' which I'm told are 'Select', 'Next' and 'Previous' respectfully for accessibility.