API15

JComponentHelper/getComponent

From Joomla! Documentation

< API15:JComponentHelper
Revision as of 16:52, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Get the component information. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowi...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API15" 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 component information.

[Edit Descripton]

Template:Description:JComponentHelper/getComponent

Syntax[edit]

static getComponent($option, $strict=false)
Parameter Name Default Value Description
$option $option The component option.
$strict false $string If set and a component does not exist, the enabled attribue will be set to false

Returns[edit]

object An object with the fields for the component.

Defined in[edit]

libraries/joomla/application/component/helper.php

Importing[edit]

jimport( 'joomla.application.component.helper' );

Source Body[edit]

public static function getComponent($option, $strict = false)
{
        if (!isset(self::$_components[$option])) {
                
                if(self::_load($option)){
                        
                        $result = &self::$_components[$option];
                        
                } else {
                        
                $result                         = new stdClass;
                $result->enabled        = $strict ? false : true;
                $result->params         = new JParameter;
                
                }
                
        } else{
                
                $result = &self::$_components[$option];
                
        }
        

        return $result;
}

[Edit See Also] Template:SeeAlso:JComponentHelper/getComponent

Examples[edit]

<CodeExamplesForm />