You are here

class ConfigIteratorSettings in Configuration Management 7.2

Hierarchy

Expanded class hierarchy of ConfigIteratorSettings

19 files declare their use of ConfigIteratorSettings
Configuration.php in lib/Drupal/configuration/Config/Configuration.php
Definition of Drupal\configuration\Config\Configuration.
ConfigurationManagement.php in lib/Drupal/configuration/Config/ConfigurationManagement.php
Definition of Drupal\configuration\Config\ConfigurationManagement.
configuration_ui.admin.inc in ui/configuration_ui.admin.inc
User interface functions for Configuration Management.
ContentTypeConfiguration.php in lib/Drupal/configuration/Config/ContentTypeConfiguration.php
Definition of Drupal\configuration\Config\ContentTypeConfiguration.
CtoolsConfiguration.php in lib/Drupal/configuration/Config/CtoolsConfiguration.php
Definition of Drupal\configuration\Config\CtoolsConfiguration.

... See full list

File

lib/Drupal/configuration/Utils/ConfigIteratorSettings.php, line 10
Definition of Drupal\configuration\Utils\ConfigIteratorSettings.

Namespace

Drupal\configuration\Utils
View source
class ConfigIteratorSettings {

  /**
   * This function will be called in each iteration. This is the resposible
   * to load the configuration object to find dependencies and optional configurations.
   */
  protected $build_callback;

  /**
   * The ConfigurationManagement::callback to call on every iteration.
   */
  protected $callback;

  /**
   * A boolean flag to indicate that the $callback must be called
   * for the dependendencies of the current processed configuration.
   *
   * @var boolean
   */
  protected $process_dependencies = TRUE;

  /**
   * A boolean flag to indicate that the $callback must be called
   * for the optional configurations of the current processed configuration.
   *
   * @var boolean
   */
  protected $process_optionals = TRUE;

  /**
   * An array that storage the already processed configurations.
   * If a configuration is in this array, it will not be loaded
   * in each iteration.
   *
   * @var array
   */
  protected $cache = array();

  /**
   * An array of already processed configurations. In the id of the
   * configuration is is this array, it will not be proccesed by the
   * iterator.
   *
   * @var array
   */
  protected $already_processed = array();

  /**
   * An array to storage the useful info obtained after process the $callback
   * function.
   *
   * For example, while discovering module dependencies, each required
   * module should be included in the $info array. When processing dependency
   * trees, the ids of the configurations to enable should be saved in this
   * array.
   *
   * @var array
   */
  protected $info = array();

  /**
   * An array of settings that can be modified by the $callback function.
   * @var array
   */
  protected $settings = array();
  function __construct($settings) {
    $keys = array(
      'process_dependencies',
      'process_optionals',
      'callback',
      'build_callback',
      'cache',
      'already_processed',
      'settings',
      'info',
    );
    foreach ($keys as $key) {
      if (isset($settings[$key])) {
        $this->{$key} = $settings[$key];
      }
    }
  }
  function processDependencies() {
    return $this->process_dependencies;
  }
  function processOptionals() {
    return $this->process_optionals;
  }
  function getCallback() {
    return $this->callback;
  }
  function getBuildCallback() {
    return $this->build_callback;
  }
  function getFromCache($id) {
    if (!empty($this->cache[$id])) {
      return $this->cache[$id];
    }
  }
  function addToCache($configuration) {
    $id = $configuration
      ->getUniqueId();
    $this->already_processed[$id] = TRUE;
    $cthis->cache[$id] = $configuration;
  }
  function excluded($configuration) {
    if (empty($this->settings['excluded'])) {
      return FALSE;
    }
    else {
      return !empty($this->settings['excluded'][$configuration
        ->getUniqueId()]);
    }
  }
  function alreadyProcessed($configuration) {
    return !empty($this->already_processed[$configuration
      ->getUniqueId()]);
  }
  function getSetting($key) {
    if (isset($this->settings[$key])) {
      return $this->settings[$key];
    }
  }
  function setSetting($key, $value) {
    $this->settings[$key] = $value;
  }
  function getInfo($key) {
    if (isset($this->info[$key])) {
      return $this->info[$key];
    }
  }
  function setInfo($key, $value) {
    $this->info[$key] = $value;
  }
  function addInfo($key, $value) {
    if (!isset($this->info[$key])) {
      $this->info[$key] = array();
    }
    $this->info[$key][] = $value;
  }
  function resetAlreadyProcessed() {
    $this->already_processed = array();
  }
  function resetCache() {
    $this->cache = array();
  }
  function resetSettings() {
    $this->settings = array();
  }
  function resetInfo() {
    $this->info = array();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigIteratorSettings::$already_processed protected property An array of already processed configurations. In the id of the configuration is is this array, it will not be proccesed by the iterator.
ConfigIteratorSettings::$build_callback protected property This function will be called in each iteration. This is the resposible to load the configuration object to find dependencies and optional configurations.
ConfigIteratorSettings::$cache protected property An array that storage the already processed configurations. If a configuration is in this array, it will not be loaded in each iteration.
ConfigIteratorSettings::$callback protected property The ConfigurationManagement::callback to call on every iteration.
ConfigIteratorSettings::$info protected property An array to storage the useful info obtained after process the $callback function.
ConfigIteratorSettings::$process_dependencies protected property A boolean flag to indicate that the $callback must be called for the dependendencies of the current processed configuration.
ConfigIteratorSettings::$process_optionals protected property A boolean flag to indicate that the $callback must be called for the optional configurations of the current processed configuration.
ConfigIteratorSettings::$settings protected property An array of settings that can be modified by the $callback function.
ConfigIteratorSettings::addInfo function
ConfigIteratorSettings::addToCache function
ConfigIteratorSettings::alreadyProcessed function
ConfigIteratorSettings::excluded function
ConfigIteratorSettings::getBuildCallback function
ConfigIteratorSettings::getCallback function
ConfigIteratorSettings::getFromCache function
ConfigIteratorSettings::getInfo function
ConfigIteratorSettings::getSetting function
ConfigIteratorSettings::processDependencies function
ConfigIteratorSettings::processOptionals function
ConfigIteratorSettings::resetAlreadyProcessed function
ConfigIteratorSettings::resetCache function
ConfigIteratorSettings::resetInfo function
ConfigIteratorSettings::resetSettings function
ConfigIteratorSettings::setInfo function
ConfigIteratorSettings::setSetting function
ConfigIteratorSettings::__construct function