Exemplo n.º 1
0
 /**
  * Add a module template directory to the parser environment
  *
  * @param ParserInterface $parser             the parser
  * @param Module          $module             the Module.
  * @param string          $templateType       the template type (one of the TemplateDefinition type constants)
  * @param string          $templateSubdirName the template subdirectory name (one of the TemplateDefinition::XXX_SUBDIR constants)
  */
 protected function addModuleTemplateToParserEnvironment($parser, $module, $templateType, $templateSubdirName)
 {
     // Get template path
     $templateDirectory = $module->getAbsoluteTemplateDirectoryPath($templateSubdirName);
     try {
         $templateDirBrowser = new \DirectoryIterator($templateDirectory);
         $code = ucfirst($module->getCode());
         /* browse the directory */
         foreach ($templateDirBrowser as $templateDirContent) {
             /* is it a directory which is not . or .. ? */
             if ($templateDirContent->isDir() && !$templateDirContent->isDot()) {
                 $parser->addMethodCall('addTemplateDirectory', array($templateType, $templateDirContent->getFilename(), $templateDirContent->getPathName(), $code));
             }
         }
     } catch (\UnexpectedValueException $ex) {
         // The directory does not exists, ignore it.
     }
 }