This repository was archived by the owner on May 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherus.api.php
More file actions
91 lines (72 loc) · 1.79 KB
/
erus.api.php
File metadata and controls
91 lines (72 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* API FUNCS
*/
/**
* Return an array of plugin information
* @return [type] [description]
*/
function hook_erus_plugin_info() {
$plugins = array();
$plugins['my_plugin'] = array(
'file' => 'plugins/myExamplePlugin.inc',
'name' => 'myExamplePluginName',
'module' => 'my_module_name',
);
return $plugins;
}
/**
* Alter plugin information
* @param [type] $plugins [description]
* @return [type] [description]
*/
function hook_erus_plugin_info_alter(&$plugins) {
}
//////////////////////////////////////////////////////////////////////////
// Extending and creating plugins
//////////////////////////////////////////////////////////////////////////
/**
* All ERUS plugins must extend the erusPlugin class.
* All ERUS plugins must declare the process() method.
*
*
*
*/
/**
* Example Erus Plugin
*/
class erusExample extends erusPlugin {
/**
* - Optional Method -
*
* Creates a configuration form at:
* admin/config/administration/erus/[-plugin_name-]
*
* A default submit handler is provided that saves all the form values
* into the variables table for you at variable_get('erus_[plugin_name]');
*
* @return [array] [config form]
*/
public function get_configuration_form() {
$form = array();
// Your form items here.
return $form;
}
/**
* - Required Method -
*
* The meat of your plugin goes in here. It is passed in update data for a
* module that has been validated to use this plugin. Add your logic here.
*
* @param [array] $data Update Data
* @return [array]
*/
public function process($data) {
// Do your stuff here.
// ...
// A guzzle client is available to you.
$client = $this->get_client();
// Get the configuration form settings
return $data;
}
}