MidCOM Toolbars

flack edited this page Dec 8, 2016 · 9 revisions

This service provides an interface for working with toolbars. To render them, the following code should be included into one of the theme's Style Elements:

midcom::get()->toolbars->show();

Structure

There are different options for displaying toolbars. The standard is to have a centralized, floating toolbar which combines all options available to the current user in the given path. You can also split this into HTML-only toolbars.

The centralized toolbar is divided into four submenus, Page, Folder, Website and Help. Page holds options for the current content object (like access to the RCS, ACL and Metadata systems, to content approval as well as edit and delete links). Folder holds options for the current Topic (controlled by midcom.admin.folder), while Website contains global options (like Logout and Cache Invalidation)

Usage in Components

Components can include custom commands into the menus. In handlers, both the view and the topic toolbar are available through inherited properties:

public function _handler_index($handler_id, array $args, array &$data)
{
    $this->_view_toolbar->add_item($my_button);
    $this->_node_toolbar->add_item($my_topic_button);
}

Apart from this, midcom_helper_toolbar can also be used independently to create and render new toolbars:

$toolbar = new midcom_helper_toolbar;
$toolbar->add_item($button);
echo $toolbar->render();