FEATURE: move default Handler::render() into parent class
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
namespace App\Handlers;
|
namespace App\Handlers;
|
||||||
|
|
||||||
use App\Handlers\Contracts\AppHandler;
|
use App\Handlers\Contracts\AppHandler;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Content;
|
use App\Models\Content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,6 +30,19 @@ abstract class Handler extends BaseHandler implements AppHandler
|
|||||||
return History::class;
|
return History::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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, 'extra' => $parameters]);
|
||||||
|
}
|
||||||
|
|
||||||
public static function getExtendedFormSections()
|
public static function getExtendedFormSections()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class Article extends Handler
|
|||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Controller::VisitorsView($content->template, ['page' => $content]);
|
return Controller::VisitorsView($content->template, ['page' => $content, 'extra' => $parameters]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getExtendedFormInputsCreate()
|
public static function getExtendedFormInputsCreate()
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class ArticleList extends Handler
|
|||||||
$articles = $articles->orderBy('created_at', 'DESC')
|
$articles = $articles->orderBy('created_at', 'DESC')
|
||||||
->paginate(20);
|
->paginate(20);
|
||||||
|
|
||||||
return Controller::VisitorsView($content->template, ['page' => $content, 'articles' => $articles]);
|
return Controller::VisitorsView($content->template, ['page' => $content, 'articles' => $articles, 'extra' => $parameters]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getModuleId()
|
public static function getModuleId()
|
||||||
|
|||||||
@@ -11,21 +11,6 @@ use App\Models\User;
|
|||||||
|
|
||||||
class ContactForm extends Handler
|
class ContactForm extends Handler
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 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)
|
|
||||||
{
|
|
||||||
$content->module_settings = json_decode($content->module_settings);
|
|
||||||
|
|
||||||
return Controller::VisitorsView($content->template, ['page' => $content]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getHistoryHandler()
|
public static function getHistoryHandler()
|
||||||
{
|
{
|
||||||
return ContactFormHistory::class;
|
return ContactFormHistory::class;
|
||||||
@@ -174,7 +159,6 @@ class ContactForm extends Handler
|
|||||||
*/
|
*/
|
||||||
public static function install()
|
public static function install()
|
||||||
{
|
{
|
||||||
// TODO: Implement install() method.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,11 +28,6 @@ class Gallery implements AppHandler
|
|||||||
*/
|
*/
|
||||||
public function render(Content $content, $parameters)
|
public function render(Content $content, $parameters)
|
||||||
{
|
{
|
||||||
// if settings is still string, convert it into object
|
|
||||||
if (is_string($content->module_settings)) {
|
|
||||||
$content->module_settings = json_decode($content->module_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get directory ID
|
// get directory ID
|
||||||
$directoryId = $content->module_settings->directoryId;
|
$directoryId = $content->module_settings->directoryId;
|
||||||
|
|
||||||
@@ -42,7 +37,11 @@ class Gallery implements AppHandler
|
|||||||
->get();
|
->get();
|
||||||
|
|
||||||
// render content
|
// render content
|
||||||
return Controller::VisitorsView($content->template, ['images' => $images, 'page' => $content]);
|
return Controller::VisitorsView($content->template, [
|
||||||
|
'images' => $images,
|
||||||
|
'page' => $content,
|
||||||
|
'extra' => $parameters
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getHistoryHandler()
|
public static function getHistoryHandler()
|
||||||
|
|||||||
@@ -33,19 +33,6 @@ class StaticPage extends Handler
|
|||||||
return $moduleId;
|
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?
|
* Does given module manage content? Or is it just module with widgets/something internal/something absolutely else?
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,26 +10,6 @@ use Templates\Base\OnePage\Handlers\OnePage;
|
|||||||
|
|
||||||
class Handler extends OnePage
|
class Handler extends OnePage
|
||||||
{
|
{
|
||||||
public static function registerAdminMenu(User $user)
|
|
||||||
{
|
|
||||||
parent::registerAdminMenu($user);
|
|
||||||
|
|
||||||
$menu = \Menu::instance('mainMenu');
|
|
||||||
|
|
||||||
$menu->dropdown(trans('template::admin/mainMenu.templateName'), function ($sub) {
|
|
||||||
$sub->route('template.setHomepage', trans('template::admin/mainMenu.setHomepage'), [], 1, ['icon' => 'fa fa-fw fa-home']);
|
|
||||||
}, 20, ['icon' => 'fa fa-fw fa-send']);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepare Content object to be rendered using Blade template
|
|
||||||
*
|
|
||||||
* @param Content $content
|
|
||||||
*/
|
|
||||||
public static function beforeRender(Content & $content)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify input data into format which can be understood by edit template
|
* Modify input data into format which can be understood by edit template
|
||||||
|
|||||||
Reference in New Issue
Block a user