Back to FileLayout class

Method setComponent

public mixed
setComponent
(mixed $option)
Method to change the component where search for layouts
Parameters
  • string $option URL Option of the component. Example: com_content
Returns
  • mixed Component option string | null for none
Since
  • 3.2
Class: FileLayout
Project: Joomla

Method setComponent - Source code

/**
 * Method to change the component where search for layouts
 *
 * @param   string  $option  URL Option of the component. Example: com_content
 *
 * @return  mixed  Component option string | null for none
 *
 * @since   3.2
 */
public function setComponent($option)
{
    $component = null;
    switch ((string) $option) {
        case 'none':
            $component = null;
            break;
        case 'auto':
            $component = ApplicationHelper::getComponentName();
            break;
        default:
            $component = $option;
            break;
    }
    // Extra checks
    if (!$this->validComponent($component)) {
        $component = null;
    }
    $this->options->set('component', $component);
    // Refresh include paths
    $this->clearIncludePaths();
}