This way should be more reliable, because config() is available only after publishing module, however I can't publish module when it does not have config (module.json). In this way I can select all modules from database and generate module.json for each of them.
97 lines
2.6 KiB
PHP
97 lines
2.6 KiB
PHP
<?php
|
|
namespace App\Handlers\Contracts;
|
|
|
|
use App\Http\Requests\Request;
|
|
use App\Models\Content;
|
|
use App\Models\User;
|
|
|
|
interface AppHandler
|
|
{
|
|
/**
|
|
* 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);
|
|
|
|
public static function getHistoryHandler();
|
|
|
|
/**
|
|
* Save module-specific values into database
|
|
*
|
|
* @param Content $content
|
|
* @param Request $request
|
|
*
|
|
* @return mixed
|
|
* @internal param Widget $widget
|
|
*/
|
|
public static function createNew(Content &$content, Request $request);
|
|
|
|
/**
|
|
* Method used for editing existing content page.
|
|
*
|
|
* Reason why it is separated from createNew() method is simple - we need to save history of changes.
|
|
*
|
|
* @param Content $content
|
|
* @param Request $request
|
|
*
|
|
* @param $revisionID string ID of revision used
|
|
*
|
|
* @return int number of edited fields
|
|
*/
|
|
public static function edit(Content &$content, Request $request, $revisionID);
|
|
|
|
/**
|
|
* Does given module manage content? Or is it just module with widgets/something internal/something absolutely else?
|
|
*
|
|
* @return bool
|
|
*/
|
|
public static function managesContent();
|
|
|
|
public static function getModuleId();
|
|
|
|
/**
|
|
* Getter for section names in creating/editing content resource
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public static function getExtendedFormSections();
|
|
|
|
/**
|
|
* Getter for views used in extended part of form for creating new content
|
|
*
|
|
* This method should return pairs <section, view-name>. View is returned only as name in plain text
|
|
*
|
|
* @return array of views/templates/html codes divided into section
|
|
*/
|
|
public static function getExtendedFormInputsCreate();
|
|
|
|
/**
|
|
* Getter for extended part of form for editing existing content
|
|
*
|
|
* Basically, this method may be
|
|
*
|
|
* @return array of views/templates/html codes divided into section
|
|
*/
|
|
public static function getExtendedFormInputsEdit();
|
|
|
|
/**
|
|
* Register admin menu (or multiple ones)
|
|
*
|
|
* This cannot be in ServiceProvider because Session is started at middleware. And ServiceProvider is called before
|
|
* starting any middleware..
|
|
*
|
|
* @param User $user model of logged user
|
|
*/
|
|
public static function registerAdminMenu(User $user);
|
|
|
|
/**
|
|
* Install module
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public static function install();
|
|
} |