Properties

$_topic

$_topic : \midcom_db_topic

The topic for which we are handling a request.

Type

\midcom_db_topic

$_request_data

$_request_data : array

Request specific data storage area. Registered in the component context as ''.

Type

array

$_node_toolbar

$_node_toolbar : \midcom_helper_toolbar

The node toolbar for the current request context. Not available during the can_handle phase.

Type

\midcom_helper_toolbar

$_view_toolbar

$_view_toolbar : \midcom_helper_toolbar

The view toolbar for the current request context. Not available during the can_handle phase.

Type

\midcom_helper_toolbar

$_handler

$_handler : Array

The handler which has been declared to be able to handle the request. The array will contain the original index of the handler in the '_route' member for backtracking purposes. The variable argument list will be placed into 'args' for performance reasons.

Type

Array

$_component

$_component : string

The name of the component, e.g. net.nehmer.static. Should be used whenever the component's name is required instead of hardcoding it.

Type

string

$_i18n

$_i18n : \midcom_services_i18n

A handle to the i18n service.

Type

\midcom_services_i18n

$_l10n

$_l10n : \midcom_services_i18n_l10n

The components' L10n string database.

Type

\midcom_services_i18n_l10n

$_l10n_midcom

$_l10n_midcom : \midcom_services_i18n_l10n

The global MidCOM string database.

Type

\midcom_services_i18n_l10n

$_config

$_config : \midcom_helper_configuration

The current configuration.

Type

\midcom_helper_configuration

$router

$router : \Symfony\Component\Routing\Router

Type

\Symfony\Component\Routing\Router

$_request_switch

$_request_switch : array

Request execution switch configuration.

The main request switch data. You need to set this during construction, it will be post-processed afterwards during initialize to provide a unified set of data. Therefore you must not modify this switch after construction.

Type

array

$_plugin_namespace_config

$_plugin_namespace_config : array

This variable keeps track of the registered plugin namespaces. It maps namespace identifiers against plugin config lists. This is used during can_handle startup to determine whether the request has to be relayed to a plugin.

You have to use the register_plugin_namespace() member function during the _on_initialize event to register plugin namespaces.

Type

array

$active_plugin

$active_plugin : 

Type

$loader

$loader : 

Type

$_services

$_services : array

Array that holds the already instantiated services

Type

array

Methods

__construct()

__construct() 

Initialize all member variables, remember to set $_component before calling this constructor from your derived classes.

initialize()

initialize(string  $component) 

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

Parameters

string $component

The name of the component.

can_handle()

can_handle(\Symfony\Component\HttpFoundation\Request  $request) : boolean

CAN_HANDLE Phase interface, checks against all registered handlers if a valid one can be found. You should not need to override this, instead, use the HANDLE Phase for further checks.

Parameters

\Symfony\Component\HttpFoundation\Request $request

Returns

boolean —

Indicating whether the request can be handled by the class, or not.

get_router()

get_router(string  $component = null) : \Symfony\Component\Routing\Router

Parameters

string $component

Returns

\Symfony\Component\Routing\Router

handle()

handle() : \midcom_response|null

Handle the request using the handler determined by the can_handle check.

Before doing anything, it will call the _on_handle event handler to allow for generic request preparation.

Returns

\midcom_response|null —

The response object (or null in the case of old-style handlers)

show()

show() 

Display the content, it uses the handler as determined by can_handle.

_on_initialize()

_on_initialize() 

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

Use this function instead of the constructor for all initialization work. You can safely populate the request switch from here.

You should not do anything else then general startup work, as this callback executes before the can_handle phase. You don't know at this point whether you are even able to handle the request. Thus, anything that is specific to your request (like HTML HEAD tag adds) must not be done here. Use _on_handle instead.

_on_handle()

_on_handle(mixed  $handler, array  $args) 

Component specific initialization code for the handle phase. The name of the request handler is passed as an argument to the event handler.

Note, that while you have the complete information around the request (handler id, args and request data) available, it is strongly discouraged to handle everything here. Instead, stay with the specific request handler methods as far as sensible.

Parameters

mixed $handler

The ID (array key) of the handler that is responsible to handle the request.

array $args

The argument list.

_on_handled()

_on_handled(  $handler, array  $args) 

Parameters

$handler
array $args

register_plugin_namespace()

register_plugin_namespace(string  $namespace, array  $config) 

Create a new plugin namespace and map the configuration to it.

It allows flexible, user-configurable extension of components.

Only very basic testing is done to keep runtime up, currently the system only checks to prevent duplicate namespace registrations. In such a case, midcom_error will be thrown. Any further validation won't be done before can_handle determines that a plugin is actually in use.

Parameters

string $namespace

The plugin namespace, checked against $args[0] during URL parsing.

array $config

The configuration of the plugin namespace as outlined in the class introduction

__get()

__get(  $field) 

Parameters

$field

__isset()

__isset(  $field) 

Parameters

$field

set_active_leaf()

set_active_leaf(  $leaf_id) 

Parameters

$leaf_id

add_stylesheet()

add_stylesheet(string  $url, string  $media = false) 

Convenience shortcut for adding CSS files

Parameters

string $url

The stylesheet URL

string $media

The media type(s) for the stylesheet, if any

get_workflow()

get_workflow(string  $identifier, array  $options = array()) : \midcom\workflow\dialog

Parameters

string $identifier
array $options

Returns

\midcom\workflow\dialog

get_available_generators()

get_available_generators() 

_prepare_handler()

_prepare_handler(array  $request) 

Prepares the handler callback for execution.

This will create the handler class instance if required.

Parameters

array $request

Throws

\midcom_error

_load_plugin()

_load_plugin(string  $namespace, string  $name) 

Load the specified namespace/plugin combo.

Any problem to load a plugin will be logged accordingly and false will be returned. Critical errors will trigger midcom_error.

Parameters

string $namespace

The plugin namespace to use.

string $name

The plugin to load from the namespace.

_register_core_plugin_namespaces()

_register_core_plugin_namespaces() 

Register the plugin namespaces provided from MidCOM core.