execute()
executeAndReturn()
executeWhileBreakCondition()
setBreakCondition()
setConditions()
setDefaultReturnValue()
setReturnArgumentPos()
_debug()
_reset()
$_breakCondition
$_defaultReturnValue
$_overwriteArguments
$_returnArgumentPos
$_returnBreakConditionDirectly
BREAK_AT_FALSE
BREAK_AT_NULL
BREAK_AT_TRUE
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
CEC_Hook::execute('Contenido.Content.Somewhere');
// example of executing a cec with a parameter but without a return value
$param = 'some value';
CEC_Hook::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 = CEC_Hook::execute('Contenido.Content.Somewhere', $param);
// example of executing a cec without a parameter but a return value (with predefined
// default return value)
CEC_Hook::setDefaultReturnValue('this is the default title');
$title = CEC_Hook::executeAndReturn('Contenido.Content.CreateTitletag');
// example of executing a cec with a parameter and a return value
// (usually the modified version of passed parameter)
$baseHref = $cfgClient[$client]['path']['htmlpath'];
$newBaseHref = CEC_Hook::executeAndReturn('Contenido.Frontend.BaseHrefGeneration', $baseHref);
// example of executing a cec with a break condition and default return value
CEC_Hook::setBreakCondition(false, true); // break condition = "false", default return value = "true"
$allow = CEC_Hook::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
CEC_Hook::setBreakCondition(true, false); // break condition = "true", default return value = "false"
$allow = CEC_Hook::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 |
subpackage | CEC |
execute() : void
Gets the desired CEC iterator and executes each registered chain function by passing the achieved arguments to it. There is
executeAndReturn() : mixed
Gets the desired CEC iterator and executes each registered chain function. You can pass as much parameter as you want.
mixed
Parameter changed/processed by chain functions. Note: If no chain function is registered, the first parameter $param after $chainName will be returnedexecuteWhileBreakCondition() : mixed
Gets the desired CEC iterator and executes each registered chain function as long as defined break condition doesn't occur.
mixed
The break condition or it's default valuesetBreakCondition(mixed $condition, mixed $defaultReturnValue) : void
mixed
mixed
setConditions(mixed $condition, bool $overwriteArguments, bool $returnbreakconditiondirectly, mixed $defaultReturnValue)
deprecated | Function is no more needed, still exists due to downwards compatibility! This is usefull, if at least on of defined cec functions returns a specific value and the execution of further functions is no more needed. The defined condition will be reset in execute() method. |
---|
mixed
One of CEC_Hook constants, with following control mechanism: - CEC_Hook::BREAK_AT_TRUE = Breaks the iteration of cec functions and returns the parameter, if the result of an function is true. - CEC_Hook::BREAK_AT_FALSE = Breaks the iteration of cec functions and returns the parameter, if the result of an function is false. - CEC_Hook::BREAK_AT_NULL = Breaks the iteration of cec functions and returns the parameter, if the result of an function is null.
bool
Flag to prevent overwriting of passed parameter to execute(). Normally the parameter will be overwritten by return value of executed functions, but this is sometimes a not wanted side effect.
bool
If a break condition is set and a chain function returns the condition set, setting this option forces the execute method to directly return that condition instead of the args
mixed
\InvalidArgumentException |
If passed type is not one of CEC_Hook constants. |
---|
setDefaultReturnValue(mixed $defaultReturnValue) : void
mixed
setReturnArgumentPos(int $pos) : void
int
Position, feasible value greater 0
_debug(mixed $var, string $msg) : void
Writes the debug value into a logfile (see contenido/logs/cec_hook_debug.log).
mixed
The variable to dump
string
Additional message
_reset() : void
$_breakCondition : int
$_defaultReturnValue : mixed
$_overwriteArguments : bool
deprecated | No more needed |
---|
$_returnArgumentPos : int
$_returnBreakConditionDirectly : bool
deprecated | No more needed |
---|
BREAK_AT_FALSE : int
deprecated | see CEC_Hook::setConditions() |
---|
BREAK_AT_NULL : int
deprecated | see CEC_Hook::setConditions() |
---|
BREAK_AT_TRUE : int
deprecated | see CEC_Hook::setConditions() |
---|