From 4774db16ef375a75b3c338a2ecc43a16ffddb900 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 11 Jul 2016 09:07:01 +0200 Subject: [PATCH] View: Add methods setHelperFunction and dropHelperFunction --- library/Icinga/Web/View.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/library/Icinga/Web/View.php b/library/Icinga/Web/View.php index 8a86d4de6..ce1ea0150 100644 --- a/library/Icinga/Web/View.php +++ b/library/Icinga/Web/View.php @@ -119,6 +119,33 @@ class View extends Zend_View_Abstract return $this; } + /** + * Set or overwrite a helper function + * + * @param string $name + * @param Closure $function + * + * @return $this + */ + public function setHelperFunction($name, Closure $function) + { + $this->helperFunctions[$name] = $function; + return $this; + } + + /** + * Drop a helper function + * + * @param string $name + * + * @return $this + */ + public function dropHelperFunction($name) + { + unset($this->helperFunctions[$name]); + return $this; + } + /** * Call a helper function *