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 removing red link to edit, no existant pages |
||
| Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Syntax=== | ===Syntax=== | ||
| Line 63: | Line 63: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Examples=== | ===Examples=== | ||
| Line 78: | Line 78: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
[[Category:Archived pages API15]] | |||
Revision as of 18:41, 12 May 2013
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
<CodeExamplesForm />