rex_fragment::addDirectory PHP Method

addDirectory() public static method

Add a path to the fragment search path.
public static addDirectory ( string $dir )
$dir string A path to a directory where fragments can be found
    public static function addDirectory($dir)
    {
        // add the new directory in front of the already know dirs,
        // so a later caller can override core settings/fragments
        $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
        array_unshift(self::$fragmentDirs, $dir);
    }

Usage Example

Exemplo n.º 1
0
    $packageOrder = array_keys(rex_package::getSetupPackages());
} else {
    $packageOrder = rex::getConfig('package-order', []);
}
// in the first run, we register all folders for class- and fragment-loading,
// so it is transparent in which order the addons are included afterwards.
foreach ($packageOrder as $packageId) {
    $package = rex_package::get($packageId);
    $folder = $package->getPath();
    // add addon path for i18n
    if (is_readable($folder . 'lang')) {
        rex_i18n::addDirectory($folder . 'lang');
    }
    // add package path for fragment loading
    if (is_readable($folder . 'fragments')) {
        rex_fragment::addDirectory($folder . 'fragments' . DIRECTORY_SEPARATOR);
    }
    // add addon path for class-loading
    if (is_readable($folder . 'lib')) {
        rex_autoload::addDirectory($folder . 'lib');
    }
    if (is_readable($folder . 'vendor')) {
        rex_autoload::addDirectory($folder . 'vendor');
    }
    $autoload = $package->getProperty('autoload');
    if (is_array($autoload) && isset($autoload['classes']) && is_array($autoload['classes'])) {
        foreach ($autoload['classes'] as $dir) {
            $dir = $package->getPath($dir);
            if (is_readable($dir)) {
                rex_autoload::addDirectory($dir);
            }
All Usage Examples Of rex_fragment::addDirectory