This service manages the toolbars used for the on-site administration system.
For each context, it provides the following set of toolbars:
The Node toolbar is applicable to the current
node, which is usually a topic. MidCOM places the topic management operations
into this toolbar, where applicable.
The View toolbar is applicable to the specific view ("url"). Usually
this maps to a single displayed object (see also the bind_to_object() member
function). MidCOM places the object-specific management operations (like
Metadata controls) into this toolbar, if it is bound to an object. Otherwise,
this toolbar is not touched by MidCOM.
It is important to understand that the default toolbars made available through this
service are completely specific to a given request context. If you have a dynamic_load
running on a given site, it will have its own set of toolbars for each instance.
In addition, components may retrieve a third kind of toolbars, which are not under
the general control of MidCOM, the Object toolbars. They apply to a single
database object (like a bound View toolbar). The usage of this kind of
toolbars is completely component-specific.
Implementation notes
It has yet to prove if the toolbar system is needed for a dynamic_load environments.
The main reason for this is that dl'ed stuff is often quite tight in space and thus cannot
display any toolbars in a sane way. Usually, the administrative tasks will be bound to the
main request.
This could be different for portal applications, which display several components on the
welcome page, each with its own management options.
Configuration
See midcom_config for configuration options.
This array is indexed by context id; each value consists of a flat array
of two toolbars, the first object being the Node toolbar, the second
View toolbar. The toolbars are created on-demand.
Type
array
$_enable_centralized
$_enable_centralized : boolean
midcom.services.toolbars has two modes, it can either display one centralized toolbar
for authenticated users, or the node and view toolbars separately for others. This
property controls whether centralized mode is enabled.
Type
boolean
$_centralized_mode
$_centralized_mode : boolean
Whether we're in centralized mode, i.e. centralized toolbar has been shown
Binds the a toolbar to a DBA object. This will append a number of globally available
toolbar options. For example, expect Metadata- and Version Control-related options
to be added.
This call is available through convenience functions throughout the framework: The
toolbar main class has a mapping for it (midcom_helper_toolbar::bind_to($object))
and object toolbars created by this service will automatically be bound to the
specified object.
Repeated bind calls are intercepted, you can only bind a toolbar to a single object.
Renders the node toolbar for the indicated context. If the toolbar is undefined,
an empty string is returned. If you want to show the toolbar directly, look for
the show_xxx_toolbar methods.
Parameters
integer
$context_id
The context to retrieve the node toolbar for, this
defaults to the current context.
Renders the view toolbar for the indicated context. If the toolbar is undefined,
an empty string is returned. If you want to show the toolbar directly, look for
the show_xxx_toolbar methods.
Parameters
integer
$context_id
The context to retrieve the node toolbar for, this
defaults to the current context.
Renders the host toolbar for the indicated context. If the toolbar is undefined,
an empty string is returned. If you want to show the toolbar directly, look for
the show_xxx_toolbar methods.
Parameters
integer
$context_id
The context to retrieve the node toolbar for, this
defaults to the current context.
Renders the help toolbar for the indicated context. If the toolbar is undefined,
an empty string is returned. If you want to show the toolbar directly, look for
the show_xxx_toolbar methods.
Parameters
integer
$context_id
The context to retrieve the node toolbar for, this
defaults to the current context.
Returns
string
—
The rendered toolbar
show_node_toolbar()
show_node_toolbar(integer $context_id = null)
Displays the node toolbar for the indicated context. If the toolbar is undefined,
an empty string is returned.
Parameters
integer
$context_id
The context to retrieve the node toolbar for, this
defaults to the current context.
show_host_toolbar()
show_host_toolbar(integer $context_id = null)
Displays the host toolbar for the indicated context. If the toolbar is undefined,
an empty string is returned.
Parameters
integer
$context_id
The context to retrieve the node toolbar for, this
defaults to the current context.
show_view_toolbar()
show_view_toolbar(integer $context_id = null)
Displays the view toolbar for the indicated context. If the toolbar is undefined,
an empty string is returned.
Parameters
integer
$context_id
The context to retrieve the node toolbar for, this
defaults to the current context.
show_help_toolbar()
show_help_toolbar(integer $context_id = null)
Displays the help toolbar for the indicated context. If the toolbar is undefined,
an empty string is returned.
Parameters
integer
$context_id
The context to retrieve the node toolbar for, this
defaults to the current context.
show()
show(integer $context_id = null)
Displays the combined MidCOM toolbar system
Parameters
integer
$context_id
The context to retrieve the node toolbar for, this
defaults to the current context.