You are here

function configuration_apply_map in Configuration Management 6

Apply an individual configuration map to the data set object

Parameters

$context: The context array for which to apply the map

$map: The configuration map to apply to the context array

Return value

An array of referenced actions that resulted from this configuration map

3 calls to configuration_apply_map()
configuration_apply_maps in ./configuration.module
Apply all module configuration maps to the data while building the action queue at the same time
configuration_process_action in ./configuration.module
Execute a single action
configuration_run_pass in ./configuration.module
Run through a pass of the configuration process

File

./configuration.module, line 516
Provide a unified method for defining site configurations abstracted from their data format. Various data formats should be supported via a plugin architecture such as XML, YAML, JSON, PHP

Code

function configuration_apply_map(&$context, $map) {
  foreach ($map as $path => &$config) {

    // TODO Make $path available in sub-functions for error reporting
    // Get the matches for this path
    $matches = configuration_fetch($path, $context, TRUE);
    while (!empty($matches)) {

      // Get and drop off the first match from the matches array
      $match =& $matches[0];
      array_shift($matches);

      // If this match is null (was unset somewhere) skip it
      if (!isset($match)) {
        continue;
      }

      // Setup a list of properties to process in the right order
      $properties = array_keys(array_intersect_key(configuration_map_properties(), $config));

      // Loop through the properties list processing one at a time
      foreach ($properties as $property) {
        $value = $config[$property];

        // Process this property
        configuration_context_process_property($property, $value, $match, $config);

        // Unset this property as we are done with it
        unset($properties[$property]);
      }
    }
  }
}