After the install.xml file has been updated, it is time to update all references to NEWMODULE in the template, and replace them with our own module's name. In this case, we will replace all references to NEWMODULE to inyourface.
CHANGES TO FILES IN THE MODULE'S ROOT DIRECTORY
In all these cases, we will be searching for "newmodule" and replacing it with "inyourface"
1. Edit index.php: For the Moodle 1.9 template, this file contains 23 references to the module name. A simple search & replace takes care of it.
2. Edit lib.php: Just like the index.php, a simple search & replace does the trick. There are 49 references to the module name in this file.
3. Edit mod_form.php: Same as above. Lather, rinse, repeat. There are 16 references to replace.
4, Edit view.php: There are 22 references to replace in this file.
CHANGES TO FILES IN THE .\lang\en_utf8 DIRECTORY
1. Rename file newmodule.php: This file should be renamed so it matches our module's name. In this case, I renamed it to inyourface.php
2. Edit the contents of the newly renamed file: Inside of the language file, all references to newmodule must be replaced with our module's name. There are 9 references to the module, but the variable $string['[MODULE]name'] should be replaced with whatever we would like Moodle to display to the end user. In our case, I have changed it to "Post to Facebook"
We are almost there. One more change . . .
CHANGES IN THE .\lang\en_utf8\help DIRECTORY
1. Rename the newmodule directory: Immediately below the \help directory, there is a single directory named newmodule. It needs to be renamed to our module's name. In our case, I renamed it to inyourface.
This directory will eventually hold all of the help files for our module. More on that later.
We are now ready to see whether our Module will be recognized by Moodle. Right now it doesn't do much of anything, but we'll beef it up once we are sure that we have made all of the right edits to the template
NEXT ARTICLE IN SERIES
No comments:
Post a Comment