Back to FileLayout class

Method getDefaultIncludePaths

public array
getDefaultIncludePaths
()
Get the default array of include paths
Returns
  • array
Since
  • 3.5
Class: FileLayout
Project: Joomla

Method getDefaultIncludePaths - Source code

/**
 * Get the default array of include paths
 *
 * @return  array
 *
 * @since   3.5
 */
public function getDefaultIncludePaths()
{
    // Get the template
    $template = Factory::getApplication()->getTemplate(true);
    // Reset includePaths
    $paths = array();
    // (1 - highest priority) Received a custom high priority path
    if ($this->basePath !== null) {
        $paths[] = rtrim($this->basePath, DIRECTORY_SEPARATOR);
    }
    // Component layouts & overrides if exist
    $component = $this->options->get('component', null);
    if (!empty($component)) {
        // (2) Component template overrides path
        $paths[] = JPATH_THEMES . '/' . $template->template . '/html/layouts/' . $component;
        if (!empty($template->parent)) {
            // (2.a) Component template overrides path for an inherited template using the parent
            $paths[] = JPATH_THEMES . '/' . $template->parent . '/html/layouts/' . $component;
        }
        // (3) Component path
        if ($this->options->get('client') == 0) {
            $paths[] = JPATH_SITE . '/components/' . $component . '/layouts';
        } else {
            $paths[] = JPATH_ADMINISTRATOR . '/components/' . $component . '/layouts';
        }
    }
    // (4) Standard Joomla! layouts overridden
    $paths[] = JPATH_THEMES . '/' . $template->template . '/html/layouts';
    if (!empty($template->parent)) {
        // (4.a) Component template overrides path for an inherited template using the parent
        $paths[] = JPATH_THEMES . '/' . $template->parent . '/html/layouts';
    }
    // (5 - lower priority) Frontend base layouts
    $paths[] = JPATH_ROOT . '/layouts';
    return $paths;
}