processExtension example



  /** * Processes extensions as a batch operation. * * @param array|\ArrayAccess $context * The batch context. */
  protected function processExtensions(&$context) {
    $operation = $this->getNextExtensionOperation();
    if (!empty($operation)) {
      $this->processExtension($operation['type']$operation['op']$operation['name']);
      $context['message'] = t('Synchronizing extensions: @op @name.', ['@op' => $operation['op'], '@name' => $operation['name']]);
      $processed_count = count($this->processedExtensions['module']['install']) + count($this->processedExtensions['module']['uninstall']);
      $processed_count += count($this->processedExtensions['theme']['uninstall']) + count($this->processedExtensions['theme']['install']);
      $context['finished'] = $processed_count / $this->totalExtensionsToProcess;
    }
    else {
      $context['finished'] = 1;
    }
  }

  /** * Processes configuration as a batch operation. * * @param array|\ArrayAccess $context * The batch context. */
protected function build() {
    $cache = [];
    // First, preprocess the theme hooks advertised by modules. This will     // serve as the basic registry. Since the list of enabled modules is the     // same regardless of the theme used, this is cached in its own entry to     // save building it for every theme.     if ($cached = $this->cache->get('theme_registry:build:modules')) {
      $cache = $cached->data;
    }
    else {
      $this->moduleHandler->invokeAllWith('theme', function Dcallable $callback, string $module) use (&$cache) {
        $this->processExtension($cache$module, 'module', $module$this->moduleList->getPath($module));
      });
      // Only cache this registry if all modules are loaded.       if ($this->moduleHandler->isLoaded()) {
        $this->cache->set("theme_registry:build:modules", $cache, Cache::PERMANENT, ['theme_registry']);
      }
    }

    // Process each base theme.     // Ensure that we start with the root of the parents, so that both CSS files     // and preprocess functions comes first.     foreach (array_reverse($this->theme->getBaseThemeExtensions()) as $base) {
      
Home | Imprint | This part of the site doesn't use cookies.