Esempio n. 1
0
 /**
  * Retrieve layout file from all module but just in current theme
  *
  * @return mixed
  */
 public function scanLayout()
 {
     $key = $this->getKey(['scan', 'all-layout', 'in', 'all-modules', 'but', 'only', 'in', 'current-theme']);
     if (is_null($this->getData($key))) {
         $pathModules = $this->module->getPath();
         $moduleDirectories = scandir($pathModules);
         foreach ($moduleDirectories as $moduleDir) {
             if (!in_array($moduleDir, [".", ".."])) {
                 /*Layouts path  của module hiện tại*/
                 $currentFolderLayoutsPathInModule = $pathModules . '/' . $moduleDir . '/themes/' . $this->izTheme->getCurrentThemeName() . '/layouts';
                 /*Check layouts path file exist*/
                 if (!file_exists($currentFolderLayoutsPathInModule)) {
                     continue;
                 }
                 $layoutFiles = scandir($currentFolderLayoutsPathInModule);
                 foreach ($layoutFiles as $layoutFile) {
                     if (!in_array($layoutFile, [".", ".."])) {
                         if (pathinfo($layoutFile, PATHINFO_EXTENSION) !== 'php') {
                             continue;
                         }
                         $layoutFileNameWithoutExt = preg_replace('/(\\.blade\\.php)$/', '', $layoutFile);
                         $this->_layouts[] = $layoutFileNameWithoutExt;
                     }
                 }
             }
         }
         $this->setData($key, $this->_layouts);
     }
     return $this->getData($key);
 }
Esempio n. 2
0
 /**
  * Return collections view by current theme
  *
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public function getViewsCollectionByCurrentThemes()
 {
     $currentThemeName = $this->izTheme->getCurrentThemeName();
     return $this->viewModel->query()->where('theme_name', $currentThemeName)->get();
 }