API16

JComponentHelper/getComponent: Difference between revisions

From Joomla! Documentation

m clean up
m preparing for archive only
 
Line 56: Line 56:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=getComponent
  category=getComponent
  category=JComponentHelper
  category=JComponentHelper
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 01:24, 25 March 2017

Description

Get the component information.


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

Syntax

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

object An object with the fields for the component.

Defined in

libraries/joomla/application/component/helper.php

Importing

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

Source Body

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;
}


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

Examples

Code Examples