FEATURE: add another repositories
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
<?php
|
||||
namespace Modules\Blog\Article\Handlers;
|
||||
|
||||
use App\CMS\Enumerations\ModulesHandlerToId;
|
||||
use App\CMS\Contracts\Content\AdvancedContentModifier;
|
||||
use App\CMS\Contracts\Modules\InstallableModule;
|
||||
use App\CMS\Handlers\Contracts\ContentTitles;
|
||||
use App\CMS\Handlers\Handler;
|
||||
use App\Http\Controllers\Admin\Contents\EditContent;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\ActionLogType;
|
||||
use App\Models\ActionLog\ActionLogType;
|
||||
use App\Models\Content\Content;
|
||||
use App\Models\Module;
|
||||
use App\Models\User;
|
||||
use Modules\Blog\Article\Entities\Comment;
|
||||
|
||||
class Article extends Handler implements ContentTitles
|
||||
class Article extends Handler implements ContentTitles, AdvancedContentModifier, InstallableModule
|
||||
{
|
||||
/**
|
||||
* Render given module into visitor area.
|
||||
@@ -109,22 +111,13 @@ class Article extends Handler implements ContentTitles
|
||||
}
|
||||
|
||||
$blogSubmenu->dropdown(trans('article::module.name'), function ($sub) {
|
||||
$sub->route('content.new', trans('article::article.new'), ['id' => self::getModuleId()], 10, ['icon' => 'fa fa-fw fa-pencil']);
|
||||
$sub->route('content.overview', trans('article::article.overview'), ['id' => self::getModuleId()], 30, ['icon' => 'fa fa-fw fa-book']);
|
||||
$sub->route('content.new', trans('article::article.new'), ['id' => config('article.alias')], 10, ['icon' => 'fa fa-fw fa-pencil']);
|
||||
$sub->route('content.overview', trans('article::article.overview'), ['id' => config('article.alias')], 30, ['icon' => 'fa fa-fw fa-book']);
|
||||
}, 10, ['icon' => 'fa fa-fw fa-book']);
|
||||
|
||||
$blogSubmenu->route('comments.overview', trans('article::module.commentsOverview'), [], 20, ['icon' => 'fa fa-fw fa-commenting-o']);
|
||||
}
|
||||
|
||||
public static function getModuleId()
|
||||
{
|
||||
$handler = config('article.handler');
|
||||
$allModules = ModulesHandlerToId::getWithTranslations();
|
||||
$moduleId = isset($allModules[$handler]) ? $allModules[$handler] : null;
|
||||
|
||||
return $moduleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install module
|
||||
*/
|
||||
@@ -153,6 +146,19 @@ class Article extends Handler implements ContentTitles
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls module
|
||||
*
|
||||
* @param Module $module
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public static function uninstall(Module $module)
|
||||
{
|
||||
ActionLogType::whereIn('string_id', ['commentCreated', 'commentDeleted', 'commentApproved'])
|
||||
->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get translated title for pages overview of given type.
|
||||
*
|
||||
@@ -186,4 +192,38 @@ class Article extends Handler implements ContentTitles
|
||||
{
|
||||
return trans('article::module.editArticle');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called right after content page is marked as deleted
|
||||
*
|
||||
* This method is supposed to clean after "deleted" page.
|
||||
*
|
||||
* @param Content $content
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function delete(Content $content)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Load some extra data for content management form?
|
||||
*
|
||||
* @param Content $content
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function loadExtraData(Content $content)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this module support categories?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function supportCategories()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user