FIX: fix content dependency on categories
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Contents;
|
||||
|
||||
use App\CMS\Contracts\Repositories\Content as IContent;
|
||||
@@ -6,20 +7,15 @@ use App\CMS\Contracts\Repositories\Module as IModuleRepository;
|
||||
use App\CMS\Contracts\Repositories\Template as ITemplate;
|
||||
use App\CMS\Enumerations\ContentStatuses;
|
||||
use App\Cms\Handlers\Interactions\Interaction;
|
||||
use App\CMS\Helpers\CurrentTemplate;
|
||||
use App\Cms\Interactions\Admin\Content\EditContent as EditContentInteraction;
|
||||
use App\Events\AttemptToEditInvalidContent;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests\EditContentRequest;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Content\Content;
|
||||
use App\Models\Content\ContentHistory;
|
||||
use App\Models\FileManager\File;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Collection;
|
||||
use Modules\Categories\Contracts\Repositories\Category as ICategory;
|
||||
use Modules\Categories\Repositories\Category;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class EditContent extends Controller
|
||||
{
|
||||
@@ -39,10 +35,6 @@ class EditContent extends Controller
|
||||
* @var IModuleRepository
|
||||
*/
|
||||
private $module;
|
||||
/**
|
||||
* @var ICategory
|
||||
*/
|
||||
private $category;
|
||||
/**
|
||||
* @var ITemplate
|
||||
*/
|
||||
@@ -50,7 +42,6 @@ class EditContent extends Controller
|
||||
|
||||
/**
|
||||
* EditContent constructor.
|
||||
*
|
||||
* Load ContentHistory and File into this controller
|
||||
*
|
||||
* @param ContentHistory $history
|
||||
@@ -60,13 +51,12 @@ class EditContent extends Controller
|
||||
* @param ICategory $category
|
||||
* @param ITemplate $template
|
||||
*/
|
||||
public function __construct(ContentHistory $history, File $file, IContent $content, IModuleRepository $module, Category $category, ITemplate $template)
|
||||
public function __construct(ContentHistory $history, File $file, IContent $content, IModuleRepository $module, ITemplate $template)
|
||||
{
|
||||
$this->history = $history;
|
||||
$this->file = $file;
|
||||
$this->content = $content;
|
||||
$this->module = $module;
|
||||
$this->category = $category;
|
||||
$this->template = $template;
|
||||
}
|
||||
|
||||
@@ -85,9 +75,13 @@ class EditContent extends Controller
|
||||
$module = $this->module->getByHandler($page->moduleHandler);
|
||||
$pageHeading = $this->module->getUpdateContentTitle($module, $page);
|
||||
$templates = $this->template->getForModule($module);
|
||||
$categories = $this->category->getForModule($module);
|
||||
$history = $this->history->getStructuredHistoryOf($page);
|
||||
|
||||
$categories = new Collection();
|
||||
if (class_exists(ICategory::class)) {
|
||||
$categories = app(ICategory::class)->getForModule($module);
|
||||
}
|
||||
|
||||
// render view
|
||||
return view('admin.content.edit', [
|
||||
'pageHeading' => $pageHeading,
|
||||
@@ -95,7 +89,8 @@ class EditContent extends Controller
|
||||
'page' => $page,
|
||||
'module' => $module,
|
||||
'categories' => $categories,
|
||||
'rootPages' => $this->content->getOverview()->get(),
|
||||
'rootPages' => $this->content->getOverview()
|
||||
->get(),
|
||||
'templates' => $templates,
|
||||
'formSectionNames' => $this->module->call($module, 'getExtendedFormSections'),
|
||||
'formSections' => $this->module->call($module, 'getExtendedFormInputsEdit'),
|
||||
|
||||
Reference in New Issue
Block a user