Files
core/templates/Jednostrankovka/Handler.php
T

86 lines
2.2 KiB
PHP

<?php
namespace Templates\Jednostrankovka;
use App\Http\Requests\Request;
use App\Models\Content;
use App\Models\User;
use Illuminate\Support\Facades\Artisan;
use Pingpong\Menus\MenuFacade;
use Templates\Base\OnePage\Handlers\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
*
* @param Content $content
*/
public static function beforePopulatingEditForm(Content & $content)
{
}
/**
* Slightly modify Content object before saving into database.
*
* This way we can do almost whatever we want - even in template
*
* @param Content $content
* @param Request $request
*/
public static function beforeSave(Content & $content, Request $request)
{
}
public static function install()
{
try {
Artisan::call('install-module', ['name' => 'StaticPages']);
} catch (\Exception $e) {
//
}
}
/**
* Get list of registered templates and supported modules.
*
* Returned array is expected to be array of arrays with following items: module, namespace and templateName.
* Example:
* return [
* ['module' => 'Article', 'templateName' => 'article::template.name']
* ];
*
* When no "namespace" is specified, value strtolower(module) is used instaed.
*
* @return array
*/
public static function getPublicTemplatePaths()
{
return [
[
'module' => 'StaticPages',
'templateName' => 'staticpages::templates.name'
]
];
}
}