JPluginHelper/importPlugin: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Loads all the plugin files for a particular type if no specific plugin is specified otherwise only the specific pugin is loaded.
<span class="editsection" style="font-... |
m preparing for archive only |
||
| (One intermediate revision by the same user not shown) | |||
| Line 2: | Line 2: | ||
Loads all the plugin files for a particular type if no specific plugin is specified otherwise only the specific pugin is loaded. | Loads all the plugin files for a particular type if no specific plugin is specified otherwise only the specific pugin is loaded. | ||
===Syntax=== | ===Syntax=== | ||
| Line 63: | Line 61: | ||
</source> | </source> | ||
===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=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
Latest revision as of 01:59, 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.
Syntax
static 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
public static function importPlugin($type, $plugin = null, $autocreate = true, $dispatcher = null)
{
$results = null;
// Load the plugins from the database.
$plugins = self::_load();
// Get the specified plugin(s).
for ($i = 0, $t = count($plugins); $i < $t; $i++) {
if ($plugins[$i]->type == $type && ($plugins[$i]->name == $plugin || $plugin === null)) {
self::_import($plugins[$i], $autocreate, $dispatcher);
$results = true;
}
}
return $results;
}
Examples
Code Examples