mirror of
https://github.com/Mibew/handlebars.php.git
synced 2025-05-02 10:16:41 +03:00
Add shorthand helpers method to engine
This commit is contained in:
parent
e7c0423dd7
commit
510ba18a37
@ -162,6 +162,55 @@ class Handlebars_Engine
|
|||||||
return $this->_helpers;
|
return $this->_helpers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new helper.
|
||||||
|
*
|
||||||
|
* @param string $name helper name
|
||||||
|
* @param mixed $helper helper callable
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addHelper($name, $helper)
|
||||||
|
{
|
||||||
|
$this->getHelpers()->add($name, $helper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a helper by name.
|
||||||
|
*
|
||||||
|
* @param string $name helper name
|
||||||
|
*
|
||||||
|
* @return callable Helper
|
||||||
|
*/
|
||||||
|
public function getHelper($name)
|
||||||
|
{
|
||||||
|
return $this->getHelpers()->get($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether this instance has a helper.
|
||||||
|
*
|
||||||
|
* @param string $name helper name
|
||||||
|
*
|
||||||
|
* @return boolean True if the helper is present
|
||||||
|
*/
|
||||||
|
public function hasHelper($name)
|
||||||
|
{
|
||||||
|
return $this->getHelpers()->has($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a helper by name.
|
||||||
|
*
|
||||||
|
* @param string $name helper name
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function removeHelper($name)
|
||||||
|
{
|
||||||
|
$this->getHelpers()->remove($name);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set current loader
|
* Set current loader
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user