/** * {@inheritdoc} */ function addMultiplePsr4(array $map) { $namespace_map = array(); foreach ($map as $namespace => $paths) { $logical_base_path = Util::namespaceLogicalPath($namespace); foreach ($paths as $root_path) { $deep_path = strlen($root_path) ? rtrim($root_path, '/') . '/' : ''; $namespace_map[$logical_base_path][$deep_path] = $this->defaultBehavior; } } $this->namespaceMap->registerDeepPaths($namespace_map); }
/** * {@inheritdoc} */ function registerNamespacesDeep($map, $behavior = NULL) { if (!isset($behavior)) { $behavior = $this->defaultBehavior; } $deep_map = array(); foreach ($map as $namespace => $deep_path) { $logical_base_path = Util::namespaceLogicalPath($namespace); $deep_path = strlen($deep_path) ? rtrim($deep_path, '/') . '/' : ''; $deep_map[$logical_base_path][$deep_path] = $behavior; } $this->namespaceMap->registerDeepPaths($deep_map); }
/** * Register lazy plugins for enabled Drupal modules and themes, assuming that * we don't know yet whether they use PSR-0, PEAR-Flat, or none of these. * * @param string[] $extensions * An array where the keys are extension names, and the values are extension * types like 'module' or 'theme'. */ function registerExtensions(array $extensions) { $prefix_map = array(); $namespace_map = array(); foreach ($extensions as $name => $type) { if (empty($this->namespaceBehaviors[$type])) { // Unsupported extension type, e.g. "theme_engine". // This can happen if a site was upgraded from Drupal 6. // See https://drupal.org/comment/8503979#comment-8503979 continue; } if (!empty($this->registered[$name])) { // The extension has already been processed. continue; } $namespace_map['Drupal/' . $name . '/'][$name] = $this->namespaceBehaviors[$type]; $prefix_map[str_replace('_', '/', $name) . '/'][$name] = $this->prefixBehaviors[$type]; $this->registered[$name] = TRUE; } $this->namespaceMap->registerDeepPaths($namespace_map); $this->prefixMap->registerDeepPaths($prefix_map); }