API16

JPluginHelper/getPlugin

From Joomla! Documentation

< API16:JPluginHelper
Revision as of 17:36, 22 March 2010 by 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-si...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

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

[Edit Descripton]

Template:Description:JPluginHelper/getPlugin

Syntax[edit]

static 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[edit]

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

Defined in[edit]

libraries/joomla/plugin/helper.php

Importing[edit]

jimport( 'joomla.plugin.helper' );

Source Body[edit]

public static function getPlugin($type, $plugin = null)
{
        $result         = array();
        $plugins        = self::_load();

        // Find the correct plugin(s) to return.
        for ($i = 0, $t = count($plugins); $i < $t; $i++)
        {
                // Are we loading a single plugin or a group?
                if (is_null($plugin))
                {
                        // Is this the right plugin?
                        if ($plugins[$i]->type == $type) {
                                $result[] = $plugins[$i];
                        }
                }
                else
                {
                        // Is this plugin in the right group?
                        if ($plugins[$i]->type == $type && $plugins[$i]->name == $plugin) {
                                $result = $plugins[$i];
                                break;
                        }
                }
        }

        return $result;
}

[Edit See Also] Template:SeeAlso:JPluginHelper/getPlugin

Examples[edit]

<CodeExamplesForm />