mirror of
https://github.com/Mibew/handlebars.php.git
synced 2024-11-15 08:44:12 +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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user