Yet more YUI confusion

Yet more YUI confusion

by Howard Miller -
Number of replies: 2
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I'm trying to get an existing YUI plugin to work...

I have read the page at http://docs.moodle.org/dev/How_to_create_a_YUI_3_module and the plugin I have does indeed look like the examples - I have set up my yui/pluginname directories, named it accordingly and it seems to get loaded.

I am a bit confused with the init script though. All the examples seem to simply return an instance of the plugin. I don't know what to do with it. I need to write some 'Y.on(...' code to actually bind (if that's the word) to a css class. Where do I put that code?
Average of ratings: -
In reply to Howard Miller

Re: Yet more YUI confusion

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Actually - forget that. The issue seems to be that the module isn't even getting loaded. The Firebug console says:

loader: Undefined module: moodle-theme_learningchannel-corners

OK , I have a file theme/learningchannel/yui/corners/corners.js and it kicks off with the line..

YUI.add('moodle-theme_learningchannel-corners', function(Y) {...

I can muck about with the file names and make deliberate errors in the js as much as I like and it makes no difference so it appears not to be loading that corners.js file.

Hmmmm... I'm a bit stuck.

In reply to Howard Miller

Re: Yet more YUI confusion

by Sam Chaffee -
Picture of Core developers

That's an interesting problem, Howard. I haven't used YUI 3 in this way much, but I have a lot in the "static" way, as the doc you reference mentions.

Without seeing the rest of your code the only thing I can add is to ask if you have something like:

$PAGE->requires->yui_module('moodle-local_hub-comments', 'M.local_hub.init_comments',
array(array('commentids' => '1 , 23 ,45')));

in one of your php files (with your appropriate parameters)?