# Plugins

class Plugins

## Constants

DATABASE_VERSION |
ADMIN_SESSION_AFTER_START | Constanta's List of Hooks
CONTENT_BEFORE_LOAD |
CONTENT_AFTER_LOAD |
BIBLIOGRAPHY_INIT |
BIBLIOGRAPHY_BEFORE_UPDATE |
BIBLIOGRAPHY_AFTER_UPDATE |
BIBLIOGRAPHY_BEFORE_SAVE |
BIBLIOGRAPHY_AFTER_SAVE |
BIBLIOGRAPHY_BEFORE_DELETE |
BIBLIOGRAPHY_AFTER_DELETE |
BIBLIOGRAPHY_CUSTOM_FIELD_DATA |
BIBLIOGRAPHY_CUSTOM_FIELD_FORM |
BIBLIOGRAPHY_BEFORE_DATAGRID_OUTPUT |
CIRCULATION_AFTER_SUCCESSFUL_TRANSACTION |
MEMBERSHIP_INIT |
MEMBERSHIP_BEFORE_UPDATE |
MEMBERSHIP_AFTER_UPDATE |
MEMBERSHIP_BEFORE_SAVE |
MEMBERSHIP_AFTER_SAVE |
OVERDUE_NOTICE_INIT |
DUEDATE_NOTICE_INIT |
MODULE_MAIN_MENU_INIT |
OAI2_INIT |

## Properties

protected array | $locations | Store plugins location, so plugins can stored in multiple location |
protected array | $plugins | Plugin scanned will store here |
protected | $active_plugins |  |
protected | $hooks |  |
protected | $menus |  |

## Methods

__construct(null $location = null)

Plugins constructor.

static Plugins
getInstance()

No description

Plugins
addLocation(array|string $location)

Add .plugin.php | plugin file into list

bool
isDeep(string $location)

Check if path location have sub-directory

array
getPlugins()

No description

array
getActive()

Get active plugins from database

bool
isActive($id)

No description

void
loadPlugins()

load .plugin.php file from plugin

void
register(string $hook, closure $callback, $sequence = 9999)

A method to listing hook into list

void
registerHook(string $hook, closure $callback, $sequence = 9999)

A shortcut to register method

static
hook($hook, $callback, $sequence = 9999)

shortcut to 'registerHook'

void
registerMenu(string $module_name, string $label, string $path, string $description = null)

A method to listing menu into SLiMS module submenut.

static
menu($module_name, $label, $path, $description = null)

Shortcut for 'registerMenu'

void
registerModule(string $module_name, string $path, string $description = '', string $callback_priv = '')

Register SLiMS Module as Plugin

static void
module(string $module_name, string $path, string $description = '', string $callback_priv = '')

A shortcut for registerModule

void
registerSearchEngine(string $class_name)

This method is relate to SLiMS\SearchEngine\Engine

void
registerSessionDriver(string $class_name)

This method is relate to SLiMS\Session\Factory

void
registerCommand(string $class_name)

This method is relate to SLiMS\Cli\Console

registerAutoload()

Seperate root composer ('slims-plugin') detector and plugin base composer (vendor inside each plugin).

getAutoload($pluginPath)

No description

static GroupMenuOrder
group(string $group_name, closure $callback)

Grouping some plugin into submenu.

setGroupName($group_name)

No description

static void
run(string $hook, array $params = [])

Running hook process.

execute($hook, $params = [])

No description

static
use(string $handler_class)

This method is part of hooking process.

for(closure $hooks)

This method call closure to use hook handler

array
getMenus(null $module = null)

No description

static void
registerPages(string $pathToPages = 'pages')

Load php files inside (pages/) of a plugin and register as module menu with hierarchical directory.

static void|object
__callStatic(string $method, array $arguments)

Magic 🪄 method to manage registing menu per module via static method call.

## Details

###
at line 76
`__construct(null $location = null)`

Plugins constructor.

#### Parameters

null | $location |

###
at line 81
`static Plugins getInstance()`

No description

#### Return Value

Plugins |

###
at line 92
`Plugins addLocation(array|string $location)`

Add .plugin.php | plugin file into list

#### Parameters

array|string | $location |

#### Return Value

Plugins |

###
at line 257
`bool isDeep(string $location)`

Check if path location have sub-directory

#### Parameters

string | $location |

#### Return Value

bool |

###
at line 267
`array getPlugins()`

No description

#### Return Value

array |

###
at line 279
`array getActive()`

Get active plugins from database

#### Return Value

array |

###
at line 286
`bool isActive($id)`

No description

#### Parameters

| $id |

#### Return Value

bool |

###
at line 298
`void loadPlugins()`

load .plugin.php file from plugin

#### Return Value

void |

###
at line 312
`void register(string $hook, closure $callback, $sequence = 9999)`

A method to listing hook into list

#### Parameters

string | $hook |
closure | $callback |
| $sequence |

#### Return Value

void |

###
at line 329
`void registerHook(string $hook, closure $callback, $sequence = 9999)`

A shortcut to register method

#### Parameters

string | $hook |
closure | $callback |
| $sequence |

#### Return Value

void |

###
at line 337
`static hook($hook, $callback, $sequence = 9999)`

shortcut to 'registerHook'

#### Parameters

| $hook |
| $callback |
| $sequence |

###
at line 352
`void registerMenu(string $module_name, string $label, string $path, string $description = null)`

A method to listing menu into SLiMS module submenut.

#### Parameters

string | $module_name |
string | $label |
string | $path |
string | $description |

#### Return Value

void |

###
at line 371
`static menu($module_name, $label, $path, $description = null)`

Shortcut for 'registerMenu'

#### Parameters

| $module_name |
| $label |
| $path |
| $description |

###
at line 385
`void registerModule(string $module_name, string $path, string $description = '', string $callback_priv = '')`

Register SLiMS Module as Plugin

#### Parameters

string | $module_name |
string | $path |
string | $description |
string | $callback_priv |

#### Return Value

void |

###
at line 435
`static void module(string $module_name, string $path, string $description = '', string $callback_priv = '')`

A shortcut for registerModule

#### Parameters

string | $module_name |
string | $path |
string | $description |
string | $callback_priv |

#### Return Value

void |

###
at line 446
`void registerSearchEngine(string $class_name)`

This method is relate to SLiMS\SearchEngine\Engine

#### Parameters

string | $class_name |

#### Return Value

void |

###
at line 457
`void registerSessionDriver(string $class_name)`

This method is relate to SLiMS\Session\Factory

#### Parameters

string | $class_name |

#### Return Value

void |

###
at line 468
`void registerCommand(string $class_name)`

This method is relate to SLiMS\Cli\Console

#### Parameters

string | $class_name |

#### Return Value

void |

###
at line 478
`registerAutoload()`

Seperate root composer ('slims-plugin') detector and plugin base composer (vendor inside each plugin).

The autoload.php will be call at plugin_container.php

###
at line 485
`getAutoload($pluginPath)`

No description

#### Parameters

| $pluginPath |

###
at line 497
`static GroupMenuOrder group(string $group_name, closure $callback)`

Grouping some plugin into submenu.

#### Parameters

string | $group_name |
closure | $callback |

#### Return Value

GroupMenuOrder |

###
at line 505
`setGroupName($group_name)`

No description

#### Parameters

| $group_name |

###
at line 517
`static void run(string $hook, array $params = [])`

Running hook process.

#### Parameters

string | $hook |
array | $params |

#### Return Value

void |

###
at line 522
`execute($hook, $params = [])`

No description

#### Parameters

| $hook |
| $params |

###
at line 545
`static use(string $handler_class)`

This method is part of hooking process.

If you have class to handle some hook, this method to set up your class.

#### Parameters

string | $handler_class |

###
at line 557
`for(closure $hooks)`

This method call closure to use hook handler

#### Parameters

closure | $hooks |

###
at line 567
`array getMenus(null $module = null)`

No description

#### Parameters

null | $module |

#### Return Value

array |

###
at line 597
`static void registerPages(string $pathToPages = 'pages')`

Load php files inside (pages/) of a plugin and register as module menu with hierarchical directory.

Description :

pages/ # first directory --- bibliography # as module ---- index.php # as file

or --- membership # as module ---- GROUP # as group name of plugin ----- index.php # as file

or if you want to grouping and ordering menu --- membership # as module ---- GROUP<after|before> # as group name of plugin, e.g : GROUP_before_TOOLS ----- index.php # as file

#### Parameters

string | $pathToPages |

#### Return Value

void |

###
at line 671
`static void|object __callStatic(string $method, array $arguments)`

Magic 🪄 method to manage registing menu per module via static method call.

e.g :

Plugins::opac($webPath, $filePaath) = Plugins::menu('opac', ...etc)

#### Parameters

string | $method |
array | $arguments |

#### Return Value

void|object |