\net_nemein_redirector_navigation

net.nemein.redirector NAP interface class.

Normally, it is enough if you override the members list_leaves() and get_node(). You usually don't even need to write a constructor, as the default one should be enough for your purposes. If you need extra initialization work done when "entering" a topic, use the event handler _on_set_object().

Summary

Methods
Properties
Constants
initialize()
get_leaves()
get_node()
set_object()
_on_set_object()
__construct()
__get()
__isset()
set_active_leaf()
add_stylesheet()
get_workflow()
$_component
$_i18n
$_l10n
$_l10n_midcom
$_config
No constants found
No protected methods found
$_topic
N/A
No private methods found
$_services
N/A

Properties

$_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

$_topic

$_topic : \midcom_db_topic

The topic for which we are handling a request.

Type

\midcom_db_topic

$_services

$_services : array

Array that holds the already instantiated services

Type

array

Methods

initialize()

initialize(string  $component) 

Initialize the NAP class, sets all state variables.

Parameters

string $component

The name of the component.

get_leaves()

get_leaves() : array

Leaf listing function, the default implementation returns an empty array indicating no leaves. Note, that the active leaf index set by the other parts of the component must match one leaf out of this list.

Here are some code fragments, that you usually connect through some kind of QB array:

<?php

foreach ($articles as $article) { $leaves[$article->id] = array ( MIDCOM_NAV_URL => $article->name . "/", MIDCOM_NAV_NAME => $article->title, MIDCOM_NAV_OBJECT => $article, MIDCOM_NAV_GUID => $article->guid, ) }

return $leaves;

Returns

array —

NAP compliant list of leaves.

get_node()

get_node() : array

Return the node configuration. This defaults to use the topic the NAP instance has been set to directly. You can usually fall back to this behavior safely.

The default uses the extra field of the topic as NAV_NAME

Returns

array —

NAP compliant node declaration

set_object()

set_object(\midcom_db_topic  $topic) : boolean

Set a new content object. This updates the local configuration copy with the topic in question. It calls the event handler _on_set_object after initializing everything in case you need to do some custom initializations as well.

Parameters

\midcom_db_topic $topic

The topic to process.

Returns

boolean —

Indicating success.

_on_set_object()

_on_set_object() : boolean

Event handler called after a new topic has been set. The configuration is already loaded at this point.

Returns

boolean —

Set this to false to indicate that you could not set this instance to the topic. NAP will abort loading this node and log the error accordingly. Return true if everything is fine.

__construct()

__construct() 

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

__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