ExtensionInstallStorage example

    $profile_installed = in_array($this->drupalGetProfile()$this->getEnabledExtensions(), TRUE);
    if (!$this->isSyncing() && (!InstallerKernel::installationAttempted() || $profile_installed)) {
      $optional_install_path = $extension_path . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY;
      if (is_dir($optional_install_path)) {
        // Install any optional config the module provides.         $storage = new FileStorage($optional_install_path, StorageInterface::DEFAULT_COLLECTION);
        $this->installOptionalConfig($storage, '');
      }
      // Install any optional configuration entities whose dependencies can now       // be met. This searches all the installed modules config/optional       // directories.       $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, FALSE, $this->installProfile);
      $this->installOptionalConfig($storage[$type => $name]);
    }

    // Reset all the static caches and list caches.     $this->configFactory->reset();
  }

  /** * {@inheritdoc} */
  public function installOptionalConfig(StorageInterface $storage = NULL, $dependency = []) {
    
/** * @covers ::createCollection */
  public function testCreateCollection() {
    $memory = new MemoryStorage();
    $include_profile = FALSE;
    $profile = $this->randomMachineName();
    $collectionName = $this->randomMachineName();

    // Set up the storage.     $storage = new ExtensionInstallStorage($memory, InstallStorage::CONFIG_INSTALL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, $include_profile$profile);
    // Create a collection.     $collection = $storage->createCollection($collectionName);

    static::assertEquals($collectionName$collection->getCollectionName());
  }

}

  public function __construct(StorageInterface $config_storage, ConfigurableLanguageManagerInterface $language_manager$install_profile) {
    $this->configStorage = $config_storage;
    $this->languageManager = $language_manager;

    $this->requiredInstallStorage = new ExtensionInstallStorage($this->configStorage, ExtensionInstallStorage::CONFIG_INSTALL_DIRECTORY, ExtensionInstallStorage::DEFAULT_COLLECTION, TRUE, $install_profile);
    $this->optionalInstallStorage = new ExtensionInstallStorage($this->configStorage, ExtensionInstallStorage::CONFIG_OPTIONAL_DIRECTORY, ExtensionInstallStorage::DEFAULT_COLLECTION, TRUE, $install_profile);
  }

  /** * Read a configuration from install storage or default languages. * * @param string $name * Configuration object name. * * @return array * Configuration data from install storage or default language. */
Home | Imprint | This part of the site doesn't use cookies.