FEATURE: add another repositories
This commit is contained in:
@@ -4,8 +4,6 @@ namespace Modules\StaticPages\Handlers;
|
||||
use App\CMS\Enumerations\ModulesHandlerToId;
|
||||
use App\CMS\Handlers\Contracts\ContentTitles;
|
||||
use App\CMS\Handlers\Handler;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Content\Content;
|
||||
use App\Models\User;
|
||||
|
||||
@@ -13,93 +11,16 @@ class StaticPage extends Handler implements ContentTitles
|
||||
{
|
||||
public static function registerAdminMenu(User $user)
|
||||
{
|
||||
parent::registerAdminMenu($user);
|
||||
|
||||
// register links in admin menu
|
||||
$menu = \Menu::instance('mainMenu');
|
||||
$submenu = $menu->whereTitle(trans('admin/mainMenu.contentPages'));
|
||||
|
||||
$submenu->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']);
|
||||
$submenu->route('content.new', trans('staticpages::adminMenu.new'), ['module' => config('staticpages.alias')], 10, ['icon' => 'fa fa-plus']);
|
||||
$submenu->route('content.overview', trans('staticpages::adminMenu.overview'), ['module' => config('staticpages.alias')], 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install module
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function install()
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
/**
|
||||
* Load some extra data for content management form?
|
||||
*
|
||||
* @param Content $content
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function loadExtraData(Content $content)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get translated title for pages overview of given type.
|
||||
*
|
||||
@@ -133,4 +54,24 @@ class StaticPage extends Handler implements ContentTitles
|
||||
{
|
||||
return trans('staticpages::module.editPage');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this module support categories?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function supportCategories()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user