Backend\Modules\Extensions\Engine\Model::existsTheme PHP Method

existsTheme() public static method

This does not check for existence in the database but on the filesystem.
public static existsTheme ( string $theme ) : boolean
$theme string Theme to check for existence.
return boolean
    public static function existsTheme($theme)
    {
        return is_dir(FRONTEND_PATH . '/Themes/' . (string) $theme) || (string) $theme == 'Core';
    }

Usage Example

Example #1
0
 /**
  * Execute the action.
  */
 public function execute()
 {
     // get parameters
     $this->currentTheme = $this->getParameter('theme', 'string');
     // does the item exist
     if ($this->currentTheme !== null && BackendExtensionsModel::existsTheme($this->currentTheme)) {
         parent::execute();
         $this->loadData();
         $this->loadDataGridTemplates();
         $this->parse();
         $this->display();
     } else {
         // no item found, redirect to index, because somebody is f*****g with our url
         $this->redirect(BackendModel::createURLForAction('Themes') . '&error=non-existing');
     }
 }
All Usage Examples Of Backend\Modules\Extensions\Engine\Model::existsTheme