You are here

public static function ConfigurationManagement::trackedConfigurations in Configuration Management 7.2

Returns a list of configurations that are currently being tracked.

Parameters

boolean $tree: A boolean flag to indicate if the tracked configuration have to be organized in a tree structure.

Return value

array If $tree is TRUE the returned array is structured in the this way:


    array(
      'content_type' => array(
        'article' => array(
          'hash' => 'c08223610b3eb55161d4539c704e40989dcf3e72',
          'name' => 'Article',
        ),
        'page' => array(
          'hash' => '5161d4539c704e40989dcf3e72c08223610b3eb5',
          'name' => 'Page',
        ),
      ),
      'variable' => array(
        'site_name' => array(
          'hash' => '539c704e40989dcf35161d4e72c08223610b3eb5',
          'name' => 'site_name',
        ),
      )
    );

    If $tree is FALSE the returned array is structured in the this way:

    array(
      'content_type.article' => array(
        'hash' => 'c08223610b3eb55161d4539c704e40989dcf3e72',
        'name' => 'Article',
      ),
      'content_type.page' => array(
        'hash' => '5161d4539c704e40989dcf3e72c08223610b3eb5',
        'name' => 'Page',
      ),
      'variable.site_name' => array(
        'hash' =>'539c704e40989dcf35161d4e72c08223610b3eb5',
        'name' => 'site_name'
      )
    );
  
13 calls to ConfigurationManagement::trackedConfigurations()
ConfigurationApiTest::testStartAndStopTracking in tests/configuration.test
ConfigurationHandlerPageManagerTestCase::testCheckModifications in tests/handlers/page_manager.test
ConfigurationManagement::allConfigurations in lib/Drupal/configuration/Config/ConfigurationManagement.php
Returns a list of configurations available in the site without distinction of tracked and not tracked.
ConfigurationManagement::exportToDataStore in lib/Drupal/configuration/Config/ConfigurationManagement.php
Export the configuration from the ActiveStore to the DataStore.
ConfigurationManagement::nonTrackedConfigurations in lib/Drupal/configuration/Config/ConfigurationManagement.php
Returns a list of configurations that are not currently being tracked.

... See full list

File

lib/Drupal/configuration/Config/ConfigurationManagement.php, line 432
Definition of Drupal\configuration\Config\ConfigurationManagement.

Class

ConfigurationManagement

Namespace

Drupal\configuration\Config

Code

public static function trackedConfigurations($tree = TRUE) {
  $excluded = static::excludedConfigurations();
  $tracked = db_select('configuration_tracked', 'ct')
    ->fields('ct', array(
    'component',
    'identifier',
    'hash',
  ))
    ->execute()
    ->fetchAll();
  $return = array();

  // Prepare the array to return
  $handlers = static::getConfigurationHandler();
  if ($tree) {
    foreach ($handlers as $component => $handler) {
      $return[$component] = array();
    }
  }
  foreach ($tracked as $object) {
    $id = $object->component . '.' . $object->identifier;
    if (in_array($id, $excluded)) {
      continue;
    }

    // Only return tracked Configurations for supported components.
    if (isset($handlers[$object->component])) {
      $all_identifiers = $handlers[$object->component]::getAllIdentifiersCached($object->component);
      if (empty($all_identifiers[$object->identifier])) {
        $name = $object->identifier;
      }
      else {
        $name = $all_identifiers[$object->identifier];
      }
      if ($tree) {
        $return[$object->component][$object->identifier] = array(
          'hash' => $object->hash,
          'name' => $name,
        );
      }
      else {
        $return[$object->component . '.' . $object->identifier] = array(
          'hash' => $object->hash,
          'name' => $name,
        );
      }
    }
  }
  return $return;
}