The concrete5.6 dashboard menu page can show bootstrap icons associated with each page.
For those developing dashboard pages that will be linked from the main dashboard menu, the icons can be simply set up in the package controller. The following code has been adapted from the v5.6.0 upgrade script. Simply add the code to the package controller, change the list for the relevant single pages and icons, then call it from the install()
and upgrade()
methods.
private function setupDashboardIcons() {
$cak = CollectionAttributeKey::getByHandle('icon_dashboard');
if (is_object($cak)) {
$iconArray = array(
// Change to list your single pages and their icons
'/dashboard/script/configure_jquickie' => 'icon-wrench',
'/dashboard/script/configure_jshint' => 'icon-wrench',
'/dashboard/script/manage_jquickie_assets' => 'icon-list',
);
foreach($iconArray as $path => $icon) {
$sp = Page::getByPath($path);
if (is_object($sp) && (!$sp->isError())) {
$sp->setAttribute('icon_dashboard', $icon);
}
}
}
}
This method can then be called from the install()
and upgrade()
methods of the package controller. On earlier versions of concrete5 it will simply skip the icons and have no side effect because it tests for the existence of the attribute key 'icon_dashboard'.
You can also set or change the icons manually through the sitemap (showing system pages) > properties > custom attributes.