API15

JPluginHelper/getPlugin: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Get the plugin data of a specific type if no specific plugin is specified otherwise only the specific plugin data is returned <span class="editsection" style="font-siz...
 
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>[[Description:JPluginHelper/getPlugin|Edit Descripton]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>


{{Description:JPluginHelper/getPlugin}}
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 66: Line 66:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JPluginHelper/getPlugin|Edit See Also]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>
{{SeeAlso:JPluginHelper/getPlugin}}
<! removed transcluded page call, red link never existed >


===Examples===
===Examples===
Line 81: Line 81:
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API15]]

Revision as of 18:41, 12 May 2013

Description

Get the plugin data of a specific type if no specific plugin is specified otherwise only the specific plugin data is returned

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

& getPlugin($type, $plugin=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

Returns

mixed An array of plugin data objects, or a plugin data object

Defined in

libraries/joomla/plugin/helper.php

Importing

jimport( 'joomla.plugin.helper' );

Source Body

function &getPlugin($type, $plugin = null)
{
        $result = array();

        $plugins = JPluginHelper::_load();

        $total = count($plugins);
        for($i = 0; $i < $total; $i++)
        {
                if(is_null($plugin))
                {
                        if($plugins[$i]->type == $type) {
                                $result[] = $plugins[$i];
                        }
                }
                else
                {
                        if($plugins[$i]->type == $type && $plugins[$i]->name == $plugin) {
                                $result = $plugins[$i];
                                break;
                        }
                }

        }

        return $result;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />