dropdown(trans('staticpages::adminMenu.staticPages'), function ($submenu) use ($user) { $submenu->route('content.new', trans('staticpages::adminMenu.new'), ['moduleId' => self::getModuleId()], 10, ['icon' => 'fa fa-plus']); $submenu->route('content.overview', trans('staticpages::adminMenu.overview'), ['moduleId' => self::getModuleId()], 20, ['icon' => 'fa fa-list']); }, 15, ['icon' => 'fa fa-newspaper-o']); } public static function getModuleId() { $handler = config('staticpages.handler'); $allModules = ModulesHandlerToId::getWithTranslations(); $moduleId = isset($allModules[$handler]) ? $allModules[$handler] : null; return $moduleId; } /** * Render given module into visitor area. * * @param Content $content DB model from table contents * @param array $parameters parameters used for modifications/custom settings of given model * * @return mixed */ public function render(Content $content, $parameters) { return Controller::VisitorsView($content->template, ['page' => $content]); } /** * Does given module manage content? Or is it just module with widgets/something internal/something absolutely else? * * @return bool */ public static function managesContent() { return true; } /** * Save module-specific values into database * * @param Content $content * @param Request $request * * @return mixed */ public static function createNew(Content &$content, Request $request) { // There is nothing more we can save. Static pages are only text saved into database. // This funcionality is already covered in saving content page alone. } /** * Method used for editing existing content page. * * Reason why it is separated from createNew() method is simple - we need to save history of changes. * * @param Content $content * @param Request $request * @param string $revisionId * * @return mixed */ public static function edit(Content &$content, Request $request, $revisionId) { // There is nothing more we can save. Static pages are only text saved into database. // This funcionality is already covered in saving content page alone. return 0; } }