| 1 | <?php |
||
| 5 | class TemplatePlugin extends Plugin { |
||
| 6 | |||
| 7 | function TemplatePlugin($id) { |
||
| 8 | $this->Plugin($id); |
||
| 9 | $this->_addHook('hook_name'); |
||
| 10 | $this->_addHook('site_admin_option_hook', 'siteAdminHooks', false); |
||
| 11 | } |
||
| 12 | |||
| 13 | function getPluginInfo() { |
||
| 14 | if (!is_a($this->pluginInfo, 'TemplatePluginInfo')) { |
||
| 15 | require_once('TemplatePluginInfo.class.php'); |
||
| 16 | $this->pluginInfo = new TemplatePluginInfo($this); |
||
| 17 | } |
||
| 18 | return $this->pluginInfo; |
||
| 19 | } |
||
| 20 | |||
| 21 | function CallHook($hook, $params) { |
||
| 22 | if ($hook == 'hook_name') { |
||
| 23 | //do Something |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | function siteAdminHooks($params) { |
||
| 30 | |||
| 31 | function process() { |
||
| 35 | } |
||
| 36 | |||
| 37 | ?> |
||
| 38 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: