Creating a new Tool Option in the Jamroom Tools Menu
If your Jamroom module would like to make a new Jamroom Tool option available to the Jamroom Master Admin, you can create a special "tools.php" script that provides the Form options for your Jamroom Tool. The "work" part of your Jamroom tool should be located in the Form Controller script.
For our example jrYouTube module, we're going to have a small Jamroom Tool that simply allows the Master Admin to browse all the entered YouTube videos and play them if they want.
So the first script we want to create is our small tools.php script - this is going to be really small since all it does is define the menu item in the Jamroom Tools menu:
* Jamroom jrYouTube Module Jamroom Tool menu item
* @copyright 2009 by Talldude Networks LLC.
* @author Brian Johnson - firstname.lastname@example.org
defined('IN_JAMROOM') or exit();
* The _tools function creates our Jamroom Tools menu entry
* @param array Jamroom master config
* @return bool returns true
jmToolCell('YouTube Video Browser',"Browse YouTube Videos entered by your Users",
You can see that the script is very simple - we:
- Define a function called "jrYouTube_tools()" - Jamroom will look for a function named ModuleName_tools - if it finds it, it will execute it.
- Within the jrYouTube_tools() function we setup a Jamroom Tools menu entry by using the jmToolCell() function, which simply creates a linkable entry that we can tie our jrYouTube.php script to.
The actual work that the new Jamroom Tool will do will be found in our Form Controller script located in the master Jamroom directory.