Back to FileLayout class

Method validComponent

protected bool
validComponent
(mixed $option = null)
Validate that the active component is valid
Parameters
  • string $option URL Option of the component. Example: com_content
Returns
  • bool
Since
  • 3.2
Class: FileLayout
Project: Joomla

Method validComponent - Source code

/**
 * Validate that the active component is valid
 *
 * @param   string  $option  URL Option of the component. Example: com_content
 *
 * @return  boolean
 *
 * @since   3.2
 */
protected function validComponent($option = null)
{
    // By default we will validate the active component
    $component = $option ?? $this->options->get('component', null);
    // Valid option format
    if (!empty($component) && substr_count($component, 'com_')) {
        // Latest check: component exists and is enabled
        return ComponentHelper::isEnabled($component);
    }
    return false;
}