Back to BaseController class

Method addPath

protected static
addPath
(mixed $type, mixed $path)
Adds to the search path for templates and resources.
Parameters
  • string $type The path type (e.g. 'model', 'view').
  • mixed $path The directory string or stream array to search.
Returns
  • static A \JControllerLegacy object to support chaining.
Since
  • 3.0

Method addPath - Source code

/**
 * Adds to the search path for templates and resources.
 *
 * @param   string  $type  The path type (e.g. 'model', 'view').
 * @param   mixed   $path  The directory string  or stream array to search.
 *
 * @return  static  A \JControllerLegacy object to support chaining.
 *
 * @since   3.0
 */
protected function addPath($type, $path)
{
    if (!isset($this->paths[$type])) {
        $this->paths[$type] = array();
    }
    // Loop through the path directories
    foreach ((array) $path as $dir) {
        // No surrounding spaces allowed!
        $dir = rtrim(Path::check($dir), '/') . '/';
        // Add to the top of the search dirs
        array_unshift($this->paths[$type], $dir);
    }
    return $this;
}