/**
  * Checks whether plugin directories are handled correctly.
  *
  * @return void
  */
 public function testPluginDirectoriesAreHandledCorrectly()
 {
     $templateHandler = new TemplateHandler();
     $this->assertSame(0, $templateHandler->getPluginDirectories()->count());
     $templateHandler->getPluginDirectories()->set('foo', 'bar');
     $this->assertTrue($templateHandler->getPluginDirectories()->containsKey('foo'));
 }
 /**
  * Returns a template handler.
  *
  * @return \Ableron\Core\Template\TemplateHandler
  */
 public function getTemplateHandler()
 {
     $templateHandler = new TemplateHandler();
     $templateHandler->getPluginDirectories()->setAll($this->getDefaultPluginDirectories()->toArray());
     return $templateHandler;
 }
Esempio n. 3
0
 /**
  * Returns the template handler.
  *
  * @return \Ableron\Core\Template\TemplateHandler
  */
 public static final function getTemplateHandler()
 {
     if (self::$templateHandler === null) {
         // instantiate template handler
         self::$templateHandler = new TemplateHandler();
         // register default plugin directories
         self::$templateHandler->getPluginDirectories()->set(ABLERON_APP_DIR . '/Core/Template/Plugins/Implementations', 'Ableron\\Core\\Template\\Plugins\\Implementations');
         // register default variables
         self::$templateHandler->getVariables()->setAll(array('application' => self::class, 'user' => self::getUser(), 'documentLocaleCode' => self::getI18nHandler()->getLocale()->getLocaleCode(), 'documentLanguageDirection' => self::getI18nHandler()->getLocale()->getLanguageDirection(), 'documentUrl' => self::getRequestHandler()->getRequest()->getUri()->toString()));
     }
     return self::$templateHandler;
 }