setModuleOverride example

return $config[$name];
    }
    else {
      // If the configuration object does not exist in the configuration       // storage, create a new object.       $config = $this->createConfigObject($name$immutable);

      if ($immutable) {
        // Get and apply any overrides.         $overrides = $this->loadOverrides([$name]);
        if (isset($overrides[$name])) {
          $config->setModuleOverride($overrides[$name]);
        }
        // Apply any settings.php overrides.         if (isset($GLOBALS['config'][$name])) {
          $config->setSettingsOverride($GLOBALS['config'][$name]);
        }
      }

      foreach ($this->configFactoryOverrides as $override) {
        $config->addCacheableDependency($override->getCacheableMetadata($name));
      }

      
    $this->config->setData($data);

    // Check original data was set correctly.     $this->assertConfigDataEquals($data);

    // Save so that the original data is stored.     $this->config->save();
    $this->assertFalse($this->config->hasOverrides());
    $this->assertOverriddenKeys($data[]);

    // Set module override data and check value before and after save.     $this->config->setModuleOverride($module_data);
    $this->assertConfigDataEquals($module_data);
    $this->assertOverriddenKeys($data$module_data);

    $this->config->save();
    $this->assertConfigDataEquals($module_data);
    $this->assertOverriddenKeys($data$module_data);

    // Reset the module overrides.     $this->config->setModuleOverride([]);
    $this->assertOverriddenKeys($data[]);

    
Home | Imprint | This part of the site doesn't use cookies.