public static function custom($value, $format)
{
if (!is_callable($format)) {
if (!is_callable($format[0])) {
throw new rex_exception('Unable to find callable ' . $format[0] . ' for custom format!');
}
$params = [];
$params['subject'] = $value;
if (is_array($format[1])) {
$params = array_merge($format[1], $params);
} else {
$params['params'] = $format[1];
}
// $format ist in der Form
// array(Name des Callables, Weitere Parameter)
return call_user_func($format[0], $params);
}
return call_user_func($format, $value);
}