Back to ComponentHelper class

Method getComponent

public static \Joomla\CMS\Component\ComponentRecord
getComponent
(mixed $option, mixed $strict = false)
Get the component information.
Parameters
  • string $option The component option.
  • bool $strict If set and the component does not exist, the enabled attribute will be set to false.
Returns
  • \Joomla\CMS\Component\ComponentRecord An object with the information for the component.
Since
  • 1.5

Method getComponent - Source code

/**
 * Get the component information.
 *
 * @param   string   $option  The component option.
 * @param   boolean  $strict  If set and the component does not exist, the enabled attribute will be set to false.
 *
 * @return  ComponentRecord  An object with the information for the component.
 *
 * @since   1.5
 */
public static function getComponent($option, $strict = false)
{
    $components = static::getComponents();
    if (isset($components[$option])) {
        return $components[$option];
    }
    $result = new ComponentRecord();
    $result->enabled = $strict ? false : true;
    $result->setParams(new Registry());
    return $result;
}