getPath() public static method

If it does not exist in the theme it will return $file.
public static getPath ( string $file ) : string
$file string Path to the file.
return string Path to the (theme) file.
 /**
  * Execute the extra
  */
 public function execute()
 {
     parent::execute();
     $this->loadData();
     $widgetTemplatesPath = FRONTEND_MODULES_PATH . '/Pages/Layout/Widgets';
     // check if the given template exists
     try {
         $template = FrontendTheme::getPath($widgetTemplatesPath . '/' . $this->data['template']);
     } catch (FrontendException $e) {
         // template does not exist; assume subpages_default.tpl
         $template = FrontendTheme::getPath($widgetTemplatesPath . '/PreviousNextNavigation.tpl');
     }
     $this->loadTemplate($template);
     $this->parse();
 }
Beispiel #2
0
 /**
  * Assign the template path
  *
  * @return string
  */
 private function assignTemplate()
 {
     $template = FrontendTheme::getPath(FRONTEND_MODULES_PATH . '/ContentBlocks/Layout/Widgets/Default.tpl');
     // is the content block visible?
     if (!empty($this->item)) {
         // check if the given template exists
         try {
             $template = FrontendTheme::getPath(FRONTEND_MODULES_PATH . '/ContentBlocks/Layout/Widgets/' . $this->item['template']);
         } catch (FrontendException $e) {
             // do nothing
         }
     } else {
         // set a default text so we don't see the template data
         $this->item['text'] = '';
     }
     return $template;
 }
Beispiel #3
0
 /**
  * Add a javascript file into the array
  *
  * @param string $file         The path to the javascript-file that should be loaded.
  * @param bool   $minify       Should the file be minified?
  * @param bool   $addTimestamp May we add a timestamp for caching purposes?
  */
 public function addJS($file, $minify = true, $addTimestamp = null, $priorityGroup = self::PRIORITY_GROUP_DEFAULT)
 {
     $file = (string) $file;
     $minify = (bool) $minify;
     $addTimestamp = (bool) $addTimestamp;
     // get file path
     if (substr($file, 0, 4) != 'http') {
         $file = Theme::getPath($file);
     }
     // no minifying when debugging
     if ($this->getContainer()->getParameter('kernel.debug')) {
         $minify = false;
     }
     if ($minify) {
         $file = $this->minifyJS($file);
     }
     $jsFile = array('file' => $file, 'add_timestamp' => $addTimestamp, 'priority_group' => $priorityGroup);
     // only add when not already in array
     if (!isset($this->jsFiles[$file])) {
         $this->jsFiles[$file] = $jsFile;
     }
 }
Beispiel #4
0
 /**
  * Set the path for the template
  *
  * @param string $path The path to set.
  */
 private function setTemplatePath($path)
 {
     $this->templatePath = FrontendTheme::getPath($path);
 }
Beispiel #5
0
 /**
  * Fetch the path for an include (theme file if available, core file otherwise)
  *    syntax: {{ getpath($file) }}
  *
  * @param string $file The base path.
  *
  * @return string
  */
 public static function getPath($file)
 {
     return Theme::getPath($file);
 }