winter/modules/system/classes/PluginBase.php

139 lines
3.2 KiB
PHP
Raw Normal View History

2014-05-14 23:24:20 +10:00
<?php namespace System\Classes;
use Illuminate\Support\ServiceProvider as ServiceProviderBase;
/**
* Plugin base class
*
* @package october\system
* @author Alexey Bobkov, Samuel Georges
*/
abstract class PluginBase extends ServiceProviderBase
{
/**
* @var array Plugin dependencies
*/
public $require = [];
/**
* @var boolean Determine if this plugin should be loaded (false) or not (true).
*/
public $disabled = false;
2014-05-14 23:24:20 +10:00
/**
* Returns information about this plugin, including plugin name and developer name.
*/
abstract public function pluginDetails();
/**
* Register method, called when the plugin is first registered.
*/
2014-10-18 11:58:50 +02:00
public function register()
{
}
2014-05-14 23:24:20 +10:00
/**
* Boot method, called right before the request route.
*/
2014-10-18 11:58:50 +02:00
public function boot()
{
}
2014-05-14 23:24:20 +10:00
/**
* Registers CMS markup tags introduced by this plugin.
*/
public function registerMarkupTags()
{
return [];
}
/**
* Registers any front-end components implemented in this plugin.
*/
public function registerComponents()
{
return [];
}
/**
* Registers back-end navigation items for this plugin.
*/
public function registerNavigation()
{
return [];
}
/**
* Registers any back-end permissions used by this plugin.
*/
public function registerPermissions()
{
return [];
}
/**
* Registers any back-end configuration links used by this plugin.
*/
public function registerSettings()
{
return [];
}
/**
* Registers any report widgets provided by this plugin.
* The widgets must be returned in the following format:
2014-06-16 08:48:26 +10:00
* [
* 'className1'=>[
* 'name' => 'My widget 1',
* 'context' => ['context-1', 'context-2'],
2014-05-14 23:24:20 +10:00
* ],
2014-06-16 08:48:26 +10:00
* 'className2' => [
* 'name' => 'My widget 2',
* 'context' => 'context-1'
2014-05-14 23:24:20 +10:00
* ]
* ]
*/
public function registerReportWidgets()
{
return [];
}
/**
* Registers any form widgets implemented in this plugin.
* The widgets must be returned in the following format:
* ['className1' => 'alias'],
* ['className2' => 'anotherAlias']
*/
public function registerFormWidgets()
{
return [];
}
/**
* Registers any mail templates implemented by this plugin.
* The templates must be returned in the following format:
* ['acme.blog::mail.welcome' => 'This is a description of the welcome template'],
* ['acme.blog::mail.forgot_password' => 'This is a description of the forgot password template'],
*/
public function registerMailTemplates()
{
return [];
}
2014-05-14 23:24:20 +10:00
/**
* Registers a new console (artisan) command
* @param $key The command name
* @param $class The command class
* @return void
*/
public function registerConsoleCommand($key, $class)
{
$key = 'command.'.$key;
2014-10-18 11:58:50 +02:00
$this->app[$key] = $this->app->share(function ($app) use ($class) {
2014-05-14 23:24:20 +10:00
return new $class;
});
$this->commands($key);
}
2014-10-18 11:58:50 +02:00
}