li3_behaviors\data\model\Behaviors::behavior()
Returns a behavior instance. Configuration of the instance can be accessed as follows.
{{{ Posts::behavior('Slug')->config(); Posts::behavior('Slug')->config('fields'); }}}
Parameters
-
string
$name
The name of the behavior.
Returns
\li3_behaviors\data\model\BehaviorIntance of the behavior.
Source
public static function behavior($name) {
$class = Libraries::locate('behavior', $name);
$model = get_called_class();
if (!isset(static::$_behaviors[$model][$class])) {
throw new RuntimeException("Behavior `{$class}` not bound to model `{$model}`.");
}
return static::$_behaviors[$model][$class];
}