Filters a piece of content through a content handler. A handler can be: - a string containing the name of a method defined in `$helper`. The method is called with 3 parameters: the value to be handled, the helper method called (`$method`) and the `$options` that were passed into `applyHandler`. - an array where the first element is an object reference, and the second element is a method name. The method name given will be called on the object with the same parameters as above. - a closure, which takes the value as the first parameter, an array containing an instance of the calling helper and the calling method name as the second, and `$options` as the third. In all cases, handlers should return the transformed version of `$value`.

Parameters

  • object $helper The instance of the object (usually a helper) that is invoking
  • string $method The object (helper) method which is applying the handler to the content
  • string $name The name of the value to which the handler is applied, i.e. `'url'`, `'path'` or `'title'`.
  • mixed $value The value to be transformed by the handler, which is ultimately returned.
  • array $options Any options which should be passed to the handler used in this call.

Returns

mixed The transformed value of `$value`, after it has been processed by a handler.

Source

						public function applyHandler($helper, $method, $name, $value, array $options = array()) {
		if (!(isset($this->_handlers[$name]) && $handler = $this->_handlers[$name])) {
			return $value;
		}

		switch (true) {
			case is_string($handler) && !$helper:
				$helper = $this->helper('html');
			case is_string($handler) && is_object($helper):
				return $helper->invokeMethod($handler, array($value, $method, $options));
			case is_array($handler) && is_object($handler[0]):
				list($object, $func) = $handler;
				return $object->invokeMethod($func, array($value, $method, $options));
			case is_callable($handler):
				return $handler($value, array($helper, $method), $options);
			default:
				return $value;
		}
	}