Execution handler subclass, to be used with the request switch in midcom_baseclasses_components_request.

Use the various event handlers to customize startup.

The basic idea is that you have separate instances of this type for the various operations in your main viewer class. This avoids cluttering up the viewer class and gives you better maintainability due to smaller code files.

Under normal operation within the same component you don't need to think about any specialties, the member variables are just references to the main request class (also known as "viewer class").

Noteworthy is the ability to export handlers for usage in other components in both libraries and full components. To make the exported handler work correctly, you need to set $this->_component to the corresponding value of the exporting component. In this case, the startup code will take the main l10n instance, the component data storage and the configuration from the exporting component. The configuration in this case is merged from the global defaults (constructed during component/library startup) and the configuration parameters set on the topic where it is invoked.

Note, that the export "mode" is only invoked if and only if the component of the handler is different of the component of the main request class.

package midcom.baseclasses

 Methods

__construct ()

Main constructor does not do much yet, it shouldn't be overridden though, use the _on_initialize event handler instead.

_on_initialize ()

Initialization event handler, called at the end of the initialization process.

Use this for all initialization work you need, as the component state is already populated when this event handler is called.

add_breadcrumb (string $url, string $title)

Registers a new breadcrumb entry

Parameters

$url

stringThe URL

$title

stringThe text to display

bind_view_to_object (\midcom_core_dbaobject $object, string $page_class)

Binds the current page view to a particular object.

This will automatically connect such things like metadata and toolbars to the correct object.

Parameters

$object

\midcom_core_dbaobjectThe DBA class instance to bind to.

$page_class

stringString describing page type, will be used for substyling

get_controller (string $type, \midcom_core_dbaobject $object)

Helper function for quick access to diverse datamanager controllers.

For this to work, the handler has to implement the respective DM2 interface

todo Maybe we should do a class_implements check here

Parameters

$type

stringThe controller type

$object

\midcom_core_dbaobjectThe object, if any

get_schema_defaults ()

Default helper function for DM2 schema-related operations

return string The default DM2 schema name

get_schema_name ()

Default helper function for DM2 schema-related operations

return string The default DM2 schema name

initialize (\midcom_baseclasses_components_request $master)

Initializes the request handler class, called by the component interface after instantiation.

Required to allow safe $this references during startup.

Be aware that it is possible that a handler can come from a different component (or library) then the master class. Take this into account when getting the component data storage, configuration and l10n instances. Configuration is merged during runtime based on the system defaults and all parameters attached to the topic we're currently operating on.

Parameters

$master

\midcom_baseclasses_components_request&$master A reference to the request class handling the request.

populate_breadcrumb_line ()

Adds the registered breadcrumb entries to context_data

 Properties

 

\midcom_baseclasses_components_request $_master

A reference to the request class that has invoked this handler instance.
 

\midcom_helper_toolbar $_node_toolbar

The node toolbar for the current request context.

Not available during the can_handle phase.

see \midcom_services_toolbars
 

Array $_request_data

Request specific data storage area.

Registered in the component context as ''.

 

\midcom_db_topic $_topic

The topic for which we are handling a request.
 

\midcom_helper_toolbar $_view_toolbar

The view toolbar for the current request context.

Not available during the can_handle phase.

see \midcom_services_toolbars
 

array $_breadcrumbs

Holds breadcrumb entries the handler wants to add