83 lines
2.1 KiB
PHP
83 lines
2.1 KiB
PHP
<?php
|
|
namespace Templates\DobrotyZPece;
|
|
|
|
use App\Http\Requests\Request;
|
|
use App\Models\Content\Content;
|
|
use App\Models\Module;
|
|
use App\Models\WidgetArea;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
use Templates\Base\OnePage\Handlers\OnePage;
|
|
|
|
class Handler extends OnePage
|
|
{
|
|
/**
|
|
* Modify input data into format which can be understood by edit template
|
|
*
|
|
* @param Content $content
|
|
*/
|
|
public static function beforePopulatingEditForm(Content & $content)
|
|
{
|
|
// nothing to do
|
|
}
|
|
|
|
/**
|
|
* 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)
|
|
{
|
|
// nothing to do
|
|
}
|
|
|
|
/**
|
|
* Install template
|
|
*/
|
|
public static function install()
|
|
{
|
|
parent::install();
|
|
|
|
try {
|
|
Artisan::call('install-module', ['name' => 'StaticPages']);
|
|
Artisan::call('install-module', ['name' => 'ContactForm']);
|
|
} catch (\Exception $e) {
|
|
// ignore message about these modules being installed
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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::admin.templatePath'
|
|
],
|
|
[
|
|
'module' => 'ContactForm',
|
|
'templateName' => 'contactform::admin/adminMenu.templatePath'
|
|
]
|
|
];
|
|
}
|
|
|
|
public static function uninstall(Module $template)
|
|
{
|
|
parent::uninstall($template);
|
|
}
|
|
}
|