for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author @jenschude <[email protected]>
*/
namespace JaySDe\HandlebarsBundle\Helper;
class CmsHelper implements HelperInterface
{
private $defaultNamespace;
* @var TranslationHelper
private $translationHelper;
public function __construct(
TranslationHelper $translationHelper,
$defaultNamespace = null
) {
$this->translationHelper = $translationHelper;
$this->defaultNamespace = !is_null($defaultNamespace) ? $defaultNamespace . ':' : '';
}
public function handle($context, $options)
$options = isset($options['hash']) ? $options['hash'] : [];
$bundle = $this->defaultNamespace;
if (isset($options['bundle'])) {
$bundle = $options['bundle'].':';
unset($options['bundle']);
$cmsKey = $bundle.$context;
$result = $this->translationHelper->handle($cmsKey, $options);
return $result;