Static CEC Hook class, provides some public methods to process registered chains at CEC (CONTENIDO Extension Chainer).

Usage:

// example of executing a cec without a parameter and return value
cApiCecHook::execute('Contenido.Content.Somewhere');

// example of executing a cec with a parameter but without a return value
$param = 'some value';
cApiCecHook::execute('Contenido.Content.Somewhere', $param);

// example of executing a cec with multiple parameter but without a return
value
$param = array('foo' => $bar, 'foo2' => $bar2);
$param = cApiCecHook::execute('Contenido.Content.Somewhere', $param);


// example of executing a cec without a parameter but a return value (with
predefined
// default return value)
cApiCecHook::setDefaultReturnValue('this is the default title');
$title = cApiCecHook::executeAndReturn('Contenido.Content.CreateTitletag');

// example of executing a cec with a parameter and a return value
// (usually the modified version of passed parameter)
$baseHref = cRegistry::getFrontendUrl();
$newBaseHref =
cApiCecHook::executeAndReturn('Contenido.Frontend.BaseHrefGeneration',
$baseHref);


// example of executing a cec with a break condition and default return value
cApiCecHook::setBreakCondition(false, true); // break condition = "false",
default return value = "true"
$allow = cApiCecHook::executeWhileBreakCondition('Contenido.Frontend.AllowEdit',
$lang, $idcat, $idart, $auth->auth['uid']);
if ($allow == false) {
    die('You're not coming in!');
}

// another example of executing a cec with a break condition and default
return value
cApiCecHook::setBreakCondition(true, false); // break condition = "true",
default return value = "false"
$allow =
cApiCecHook::executeWhileBreakCondition('Contenido.Frontend.CategoryAccess',
$lang, $idcat, $auth->auth['uid']);
if ($allow == false) {
    die('I said, you're not coming in!');
}
author Murat Purc
package CONTENIDO Backend Classes

 Methods

__construct()

__construct() 
deprecated Class was renamed to cApiCecHook

Method to execute registered functions for CONTENIDO Extension Chainer (CEC).

execute() : void
InheritedStatic

Gets the desired CEC iterator and executes each registered chain function by passing the achieved arguments to it. There is

inherited_from \cApiCecHook::execute()

Method to execute registered functions for CONTENIDO Extension Chainer (CEC).

executeAndReturn() : mixed
InheritedStatic

Gets the desired CEC iterator and executes each registered chain function. You can pass as much parameter as you want.

inherited_from \cApiCecHook::executeAndReturn()

Returns

mixedParameter changed/processed by chain functions. Note: If no chain function is registered, the first parameter $param after $chainName will be returned

CEC function to process chains untill a break condition occurs.

executeWhileBreakCondition() : mixed
InheritedStatic

Gets the desired CEC iterator and executes each registered chain function as long as defined break condition doesn't occur.

inherited_from \cApiCecHook::executeWhileBreakCondition()

Returns

mixedThe break condition or it's default value

Temporaly setting of break condition and optional the default return value.

setBreakCondition(mixed $condition, mixed $defaultReturnValue) : void
InheritedStatic
inherited_from \cApiCecHook::setBreakCondition()

Parameters

$condition

mixed

$defaultReturnValue

mixed

Temporaly setting of default return value.

setDefaultReturnValue(mixed $defaultReturnValue) : void
InheritedStatic
inherited_from \cApiCecHook::setDefaultReturnValue()

Parameters

$defaultReturnValue

mixed

Temporaly setting of position in argument to return.

setReturnArgumentPos(int $pos) : void
InheritedStatic
inherited_from \cApiCecHook::setReturnArgumentPos()

Parameters

$pos

int

Position, feasible value greater 0

Exceptions

\cInvalidArgumentException if the given position is less than 1

Used to debug some status informations.

_debug(mixed $var, string $msg) : void
InheritedStatic
inherited_from \cApiCecHook::_debug()

Parameters

$var

mixed

The variable to dump

$msg

string

Additional message

Resets some properties to defaults

_reset() : void
InheritedStatic
inherited_from \cApiCecHook::_reset()

 Properties

 

$_breakCondition : int
Inherited
inherited_from \cApiCecHook::$$_breakCondition
 

$_defaultReturnValue : mixed
Inherited
inherited_from \cApiCecHook::$$_defaultReturnValue
 

$_returnArgumentPos : int
Inherited

It's used by cApiCecHook::executeAndReturn() to store/extract the return value into/from arguments list.

inherited_from \cApiCecHook::$$_returnArgumentPos