/** * Registers routes for the entire CMS. * * @return $this */ protected function registerViewComposers() { view()->composer($this->core->config('views.menu'), MenuComposer::class); view()->composer($this->core->config('views.top'), TopComposer::class); view()->composer($this->core->config('views.locale-switch'), LocaleComposer::class); return $this; }
/** * Returns the cacheTags to use, if any, or false if none set. * * @return string[]|false */ protected function getCacheTags() { $tags = $this->core->config('cache.tags', false); if (false === $tags || empty($tags)) { return false; } return is_array($tags) ? $tags : [$tags]; }
/** * Determines and returns the available locales for the application. * * @return string[] */ public function getAvailable() { // If explicitly set in CMS config, this overrules all else $configLocales = $this->core->config('locale.available'); if (is_array($configLocales)) { return $configLocales; } // Check if the localization package is used, and get locales from it $localizationLocales = $this->getLocalesForMcamaraLocalization(); if ($localizationLocales) { return $localizationLocales; } // Alternatively, check if translatable package locales are available $localizationLocales = $this->getLocalesForTranslatable(); if ($localizationLocales) { return $localizationLocales; } // Fallback is to check whether the default locale is equal to the fallback locale // If it isn't, we still have two locales to provide, otherwise localization is disabled. return array_unique([config('app.locale'), config('app.fallback_locale')]); }
/** * Returns the default action to bind to the root /. * * @return string|array */ protected function getDefaultHomeAction() { return $this->core->config('route.default'); }
/** * @return string */ protected function getSessionLocale() { $sessionKey = $this->core->config('session.prefix') . 'locale'; return session($sessionKey); }
/** * Returns the middleware group that all CMS web routes belongs to. * * @return string */ protected function getConfiguredWebGroupName() { return $this->core->config('middleware.group', 'cms'); }