Back to Factory class

Method getConfig

public static \Joomla\Registry\Registry
getConfig
(mixed $file = null, mixed $type = 'PHP', mixed $namespace = '')
Get a configuration object
Parameters
  • string $file The path to the configuration file
  • string $type The type of the configuration file
  • string $namespace The namespace of the configuration file
Returns
  • \Joomla\Registry\Registry
Since
  • 1.7.0
Deprecated
  • 5.0
-
  • \Joomla\Registry\Registry
Class: Factory
Project: Joomla

Method getConfig - Source code

/**
 * Get a configuration object
 *
 * Returns the global {@link \JConfig} object, only creating it if it doesn't already exist.
 *
 * @param   string  $file       The path to the configuration file
 * @param   string  $type       The type of the configuration file
 * @param   string  $namespace  The namespace of the configuration file
 *
 * @return  Registry
 *
 * @see         Registry
 * @since       1.7.0
 * @deprecated  5.0  Use the configuration object within the application.
 */
public static function getConfig($file = null, $type = 'PHP', $namespace = '')
{
    @trigger_error(sprintf('%s() is deprecated. The configuration object should be read from the application.', __METHOD__), E_USER_DEPRECATED);
    /**
     * If there is an application object, fetch the configuration from there.
     * Check it's not null because LanguagesModel can make it null and if it's null
     * we would want to re-init it from configuration.php.
     */
    if (self::$application && self::$application->getConfig() !== null) {
        return self::$application->getConfig();
    }
    if (!self::$config) {
        if ($file === null) {
            $file = JPATH_CONFIGURATION . '/configuration.php';
        }
        self::$config = self::createConfig($file, $type, $namespace);
    }
    return self::$config;
}