Back to Table class

Method addIncludePath

public static array
addIncludePath
(mixed $path = null)
Add a filesystem path where Table should search for table class files.
Parameters
  • array|string $path A filesystem path or array of filesystem paths to add.
Returns
  • array An array of filesystem paths to find Table classes in.
Since
  • 1.7.0
Deprecated
  • 5.0
Class: Table
Project: Joomla

Method addIncludePath - Source code

/**
 * Add a filesystem path where Table should search for table class files.
 *
 * @param   array|string  $path  A filesystem path or array of filesystem paths to add.
 *
 * @return  array  An array of filesystem paths to find Table classes in.
 *
 * @since       1.7.0
 * @deprecated  5.0 Should not be used anymore as tables are loaded through the MvcFactory
 */
public static function addIncludePath($path = null)
{
    // If the internal paths have not been initialised, do so with the base table path.
    if (empty(self::$_includePaths)) {
        self::$_includePaths = array(__DIR__);
    }
    // Convert the passed path(s) to add to an array.
    settype($path, 'array');
    // If we have new paths to add, do so.
    if (!empty($path)) {
        // Check and add each individual new path.
        foreach ($path as $dir) {
            // Sanitize path.
            $dir = trim($dir);
            // Add to the front of the list so that custom paths are searched first.
            if (!\in_array($dir, self::$_includePaths)) {
                array_unshift(self::$_includePaths, $dir);
            }
        }
    }
    return self::$_includePaths;
}