Backend\Modules\ContentBlocks\Engine\Model::getTemplates PHP Method

getTemplates() public static method

Get templates.
Deprecation: moved to the FormType
public static getTemplates ( ) : array
return array
    public static function getTemplates()
    {
        trigger_error('Backend\\Modules\\ContentBlocks\\Engine is deprecated.
             Switch to doctrine instead.', E_USER_DEPRECATED);
        $templates = array();
        $finder = new Finder();
        $finder->name('*.html.twig');
        $finder->in(FRONTEND_MODULES_PATH . '/ContentBlocks/Layout/Widgets');
        // if there is a custom theme we should include the templates there also
        $theme = BackendModel::get('fork.settings')->get('Core', 'theme', 'core');
        if ($theme != 'core') {
            $path = FRONTEND_PATH . '/Themes/' . $theme . '/Modules/ContentBlocks/Layout/Widgets';
            if (is_dir($path)) {
                $finder->in($path);
            }
        }
        foreach ($finder->files() as $file) {
            $templates[] = $file->getBasename();
        }
        return array_unique($templates);
    }

Usage Example

Example #1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $this->templates = BackendContentBlocksModel::getTemplates();
     $this->loadForm();
     $this->validateForm();
     $this->parse();
     $this->display();
 }
All Usage Examples Of Backend\Modules\ContentBlocks\Engine\Model::getTemplates