PluginBase

Implements \ls\pluginmanager\iPlugin

Base class for plugins.

Methods

Constructor for the plugin

__construct(\ls\pluginmanager\PluginManager $manager, int $id) 
todo

Add proper type hint in 3.0

Arguments

$manager

\ls\pluginmanager\PluginManager

The plugin manager instantiating the object

$id

int

The id for storage

This function retrieves plugin data. Do not cache this data; the plugin storage engine will handling caching. After the first call to this function, subsequent calls will only consist of a few function calls and array lookups.

get(string $key = null, string $model = null, int $id = null, mixed $default = null) : boolean

Arguments

$key

string

$model

string

$id

int

$default

mixed

The default value to use when not was set

Response

boolean

Return the description for this plugin

getDescription() 
static

Get the current event this plugin is responding to

getEvent() : \ls\pluginmanager\PluginEvent

Returns the id of the plugin

getId() : int

Used by storage model to find settings specific to this plugin

Response

int

Provides meta data on the plugin settings that are available for this plugin.

getPluginSettings($getValues = true) 

This does not include enable / disable; a disabled plugin is never loaded.

Arguments

$getValues

getName

getName() 
static

Returns the plugin storage and takes care of instantiating it

getStore() : \ls\pluginmanager\iPluginStorage

Publishes plugin assets.

publish($fileName) 

Arguments

$fileName

registerSetting

registerSetting(string $name, array $options = array('type' => 'string')) 

Arguments

$name

string

Name of the setting.
The type of the setting is either a basic type or choice. The choice type is either a single or a multiple choice setting.

$options

array

Contains parameters for the setting. The 'type' key contains the parameter type. The type is one of: string, int, float, choice. Supported keys per type: String: max-length(int), min-length(int), regex(string). Int: max(int), min(int). Float: max(float), min(float). Choice: choices(array containing values as keys and names as values), multiple(bool) Note that the values for choice will be translated.

saveSettings

saveSettings(\ls\pluginmanager\type $settings) 

Arguments

$settings

\ls\pluginmanager\type

This function stores plugin data.

set(string $key, mixed $data, string $model = null, int $id = null) : boolean

Arguments

$key

string

$data

mixed

$model

string

$id

int

Response

boolean

Set the event to the plugin, this method is executed by the PluginManager just before dispatching the event.

setEvent(\ls\pluginmanager\PluginEvent $event) : \ls\pluginmanager\PluginBase

This function subscribes the plugin to receive an event.

subscribe(string $event, string $function = null) 

Arguments

$event

string

$function

string

This function unsubscribes the plugin from an event.

unsubscribe(string $event) 

Arguments

$event

string

Look for views in plugin views/ folder and render it (no echo)

renderPartial(string $viewfile, array $data, boolean $return = false, boolean $processOutput = false) : \ls\pluginmanager\string;

Arguments

$viewfile

string

Filename of view in views/ folder

$data

array

$return

boolean

$processOutput

boolean

Response

\ls\pluginmanager\string;

To find the plugin locale file, we need late runtime result of __DIR__.

getDir() : string

Solution copied from http://stackoverflow.com/questions/18100689/php-dir-evaluated-runtime-late-binding

Response

string

Properties

api

api : \ls\pluginmanager\LimesurveyApi

event

event : \ls\pluginmanager\PluginEvent

id

id : 

storage

storage : 

description

description : 
static

name

name : 
static

store

store : 

settings

settings : 

This holds the pluginmanager that instantiated the plugin

pluginManager : \ls\pluginmanager\PluginManager