64 lines
1.7 KiB
PHP
64 lines
1.7 KiB
PHP
<?php
|
|
namespace App\CMS\Handlers\Contracts;
|
|
|
|
use App\Http\Requests\Request;
|
|
use App\Models\Content\Content;
|
|
use App\Models\Module;
|
|
|
|
/**
|
|
* Interface TemplateHandler
|
|
*
|
|
* Inerface used for registering template into CMS core.
|
|
*
|
|
* @package App\CMS\Handlers\Contracts
|
|
*/
|
|
interface TemplateHandler extends BaseModuleHandler
|
|
{
|
|
/**
|
|
* Uninstall template
|
|
*
|
|
* Delete some items in database, delete files etc.
|
|
*
|
|
* @param Module $template
|
|
*/
|
|
public static function uninstall(Module $template);
|
|
|
|
/**
|
|
* 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();
|
|
|
|
/**
|
|
* 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);
|
|
} |