mRFC 0036: Administrative modules for Asgard
Asgard is the administrative interface used for Midgard CMS. By default it provides a comprehensive object browser and management tool.
It is possible to extend the Asgard functionality by adding other modules to the system.
Request handler plugin setup
Components wishing to operate as Asgard plugins must have a class that registers plugin handler classes to the request switch. This is defined in component manifest via:
'customdata' => array
(
'asgard_plugin' => array
(
'class' => 'net_example_adminmodule_request',
'src' => 'file:/net/example/adminmodule/request.php',
'name' => 'Example admin',
'config' => null,
),
),
The actual class must have a method get_plugin_handlers() that returns a request switch array and initiates the Asgard library:
function get_plugin_handlers()
{
$_MIDCOM->load_library('midgard.admin.asgard');
$_MIDCOM->auth->require_valid_user();
return Array
(
'index' => Array
(
'handler' => array('net_example_adminmodule_handler_main', 'main'),
),
);
}
Note: There must be handler for a view without arguments as this will be the screen users enter when choosing the module from Asgard navigation.
Handler class
The handler class must populate some data used by Asgard.
Handle phase
During the handle phase the plugin must register itself to Asgard:
$my_title = $_MIDCOM->i18n->get_string('example admin plugin', 'net.example.adminplugin');
midgard_admin_asgard_plugin::prepare_plugin($my_title, &$data);
Show phase
During show phase the element must show Asgard's elements around its own content:
midcom_show_style('midgard_admin_asgard_header');
midcom_show_style('midgard_admin_asgard_middle');
// Show plugin's own output
midcom_show_style('midgard_admin_asgard_footer');
