JPluginHelper/importPlugin: Difference between revisions
From Joomla! Documentation
m removing red link to edit, no existant pages |
m preparing for archive only |
||
| Line 68: | Line 68: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=importPlugin | category=importPlugin | ||
category=JPluginHelper | category=JPluginHelper | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 01:02, 25 March 2017
Description
Loads all the plugin files for a particular type if no specific plugin is specified otherwise only the specific pugin is loaded.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
importPlugin($type, $plugin=null, $autocreate=true, $dispatcher=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $type | $type The plugin type, relates to the sub-directory in the plugins directory | |
| $plugin | null | $plugin The plugin name |
| $autocreate | true | |
| $dispatcher | null |
Returns
boolean True if success
Defined in
libraries/joomla/plugin/helper.php
Importing
jimport( 'joomla.plugin.helper' );
Source Body
function importPlugin($type, $plugin = null, $autocreate = true, $dispatcher = null)
{
$result = false;
$plugins = JPluginHelper::_load();
$total = count($plugins);
for($i = 0; $i < $total; $i++) {
if($plugins[$i]->type == $type && ($plugins[$i]->name == $plugin || $plugin === null)) {
JPluginHelper::_import( $plugins[$i], $autocreate, $dispatcher );
$result = true;
}
}
return $result;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples