public function getList($templateType, $base = THELIA_TEMPLATE_DIR)
    {
        $list = $exclude = array();

        $tplIterator = TemplateDefinition::getStandardTemplatesSubdirsIterator();

        foreach ($tplIterator as $type => $subdir) {
            if ($templateType == $type) {
                $baseDir = rtrim($base, DS).DS.$subdir;

                try {
                    // Every subdir of the basedir is supposed to be a template.
                    $di = new \DirectoryIterator($baseDir);

                    /** @var \DirectoryIterator $file */
                    foreach ($di as $file) {
                        // Ignore 'dot' elements
                        if ($file->isDot() || ! $file->isDir()) {
                            continue;
                        }

                        // Ignore reserved directory names
                        if (\in_array($file->getFilename(), $exclude)) {
                            continue;
                        }

                        $list[] = new TemplateDefinition($file->getFilename(), $templateType);
                    }
                } catch (\UnexpectedValueException $ex) {
                    // Ignore the exception and continue
                }
            }
        }

        return $list;
    }
public function getList($templateType, $base = THELIA_TEMPLATE_DIR)
    {
        $list = $exclude = array();

        $tplIterator = TemplateDefinition::getStandardTemplatesSubdirsIterator();

        foreach ($tplIterator as $type => $subdir) {
            if ($templateType == $type) {
                $baseDir = rtrim($base, DS).DS.$subdir;

                try {
                    // Every subdir of the basedir is supposed to be a template.
                    $di = new \DirectoryIterator($baseDir);

                    /** @var \DirectoryIterator $file */
                    foreach ($di as $file) {
                        // Ignore 'dot' elements
                        if ($file->isDot() || ! $file->isDir()) {
                            continue;
                        }

                        // Ignore reserved directory names
                        if (\in_array($file->getFilename(), $exclude)) {
                            continue;
                        }

                        $list[] = new TemplateDefinition($file->getFilename(), $templateType);
                    }
                } catch (\UnexpectedValueException $ex) {
                    // Ignore the exception and continue
                }
            }
        }

        return $list;
    }
public function getList ( $ templateType , $ base = THELIA_TEMPLATE_DIR ) { $ list = $ exclude = array ( ) ; $ tplIterator = TemplateDefinition :: getStandardTemplatesSubdirsIterator ( ) ; foreach ( $ tplIterator as $ type => $ subdir ) { if ( $ templateType == $ type ) { $ baseDir = rtrim ( $ base , DS ) . DS . $ subdir ; try { // Every subdir of the basedir is supposed to be a template. $ di = new \ DirectoryIterator ( $ baseDir ) ; /** @var \DirectoryIterator $file */ foreach ( $ di as $ file ) { // Ignore 'dot' elements if ( $ file -> isDot ( ) || ! $ file -> isDir ( ) ) { continue ; } // Ignore reserved directory names if ( \ in_array ( $ file -> getFilename ( ) , $ exclude ) ) { continue ; } $ list [ ] = new TemplateDefinition ( $ file -> getFilename ( ) , $ templateType ) ; } } catch ( \ UnexpectedValueException $ ex ) { // Ignore the exception and continue } } } return $ list ; }
Return a list of existing templates for a given template type

@param  int $templateType the template type
@param string $base the template base (module or core, default to core).
@return TemplateDefinition[] of \Thelia\Core\Template\TemplateDefinition
Return a list of existing templates for a given template type