Sometimes, a plugin needs to display information relative to its operation directly in the dashboard. For instance, the daInstaller plugin adds an orange icon when updates are available. This page will explain you how to get to this result.
Dotclear 2.3 introdcued a new user interface that allowed users to define their own favorites. Here is how a plugin can add an icon to the list of available icons:
In the plugin _admin.php
file:
$core->addBehavior('adminDashboardFavs',array('myPluginBehaviors','dashboardFavs')); class myPluginBehaviors { public static function dashboardFavs($core,$favs) { $favs['myplugin'] = new ArrayObject(array( 'myplugin', __('My Plugin'), 'plugin.php?p=myplugin', 'index.php?pf=myplugin/icon.png', 'index.php?pf=myplugin/icon-big.png', 'usage,contentadmin', null, null)); } }
The arguments to provide when calling the dashboardFavs()
function are:
A plugin can register as many favorites as needed. The icons used in Dotclear come from a package made specially for Dotclear, check the Dotclear 2.4 announcement post for more information.
Moreover, the plugin can customize the information (title, small icon and big icon) of a favorite registered and displayed on the dashboard.
Here is how:
In the plugin_admin.php
file:
$core->addBehavior('adminDashboardFavsIcon',array('myPluginBehaviors','dashboardFavsIcon')); class myPluginBehaviors { public static function dashboardFavsIcon($core,$name,$icon) { if ($name == 'myplugin') { $icon[0] = __('My plugin'); $icon[1] = 'plugin.php?p=myplugin'; $icon[2] = 'index.php?pf=myplugin/icon-big.png'; } } }
The arguments to provide when calling the dashboardFavsIcon()
function are:
The link name, the URL and the image can be modified according to the tests added in dashboardFavsIcon()
.
Wiki powered by Dokuwiki.