Using templates for conditions HTML fragments

This commit is contained in:
Franck Allimant
2014-05-02 12:06:21 +02:00
parent 859e9ca60b
commit 5518c6f0bd
4 changed files with 34 additions and 5 deletions

View File

@@ -18,6 +18,8 @@ use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\TranslatorInterface;
use Thelia\Condition\ConditionEvaluator;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Model\Coupon;
use Thelia\Model\CouponQuery;
use Thelia\Cart\CartTrait;
@@ -43,6 +45,9 @@ class BaseFacade implements FacadeInterface
/** @var Translator Service Translator */
protected $translator = null;
/** @var ParserInterface The thelia parser */
private $parser = null;
/**
* Constructor
*
@@ -197,6 +202,23 @@ class BaseFacade implements FacadeInterface
return $this->container->get('thelia.translator');
}
/**
* Return platform Parser
*
* @return ParserInterface
*/
public function getParser()
{
if ($this->parser == null) {
$this->parser = $this->container->get('thelia.parser');
// Define the current back-office template that should be used
$this->parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveAdminTemplate());
}
return $this->parser;
}
/**
* Return the main currency
* THe one used to set prices in BackOffice