Exemple #1
0
 /**
  * Create path of object media
  * @param  string $alias [description]
  * @return string   return path created
  */
 protected function buildPath($alias = '')
 {
     $path = '';
     if (strlen($this->pageName)) {
         $path .= strtolower($this->pageName);
         if ($this->pageId != 0) {
             $path .= '/' . $this->pageId;
         }
     }
     if (strlen($this->blockName)) {
         if (strlen($path) > 0) {
             $path .= '/';
         }
         $path .= 'block_' . strtolower($this->blockName);
         if ($this->blockCounter != 0) {
             $path .= '/' . $this->blockCounter;
         }
         if (strlen($this->fileId)) {
             $path .= '/' . $this->fileId;
         }
     }
     if (strlen($path) > 0) {
         // $current_language = \Innomedia\Locale\LocaleWebApp::getCurrentLanguage('backend');
         $folder = \Innomedia\Locale\LocaleWebApp::getLanguageOfBlock($this->blockName, 'backend');
         $path .= '/' . str_replace('__', '', $folder);
         $path .= '/';
     }
     $name = $this->name;
     if (strlen($alias)) {
         $name = pathinfo($this->name, PATHINFO_BASENAME) . '_' . $alias . '.' . pathinfo($this->name, PATHINFO_EXTENSION);
     }
     $path .= $name;
     return $path;
 }