You are here

function sarnia_features_pipe_alter in Sarnia 7

Implements hook_features_pipe_alter().

Parameters

$pipe:

$data:

$export:

File

./sarnia.module, line 1217

Code

function sarnia_features_pipe_alter(&$pipe, $data, &$export) {

  // If exporting a Sarnia search index, also export the entity type and vice versa.
  if (in_array($export['component'], array(
    'search_api_index',
    'sarnia_entity_type',
  ))) {
    module_load_include('inc', 'sarnia', 'sarnia.entities');
    $types = _sarnia_entity_types();
    $depends = $export['component'] == 'sarnia_entity_type' ? 'search_api_index' : 'sarnia_entity_type';
    foreach ($data as $component) {
      if (in_array($component, array_keys($types))) {
        $export['features'][$depends][$component] = $component;
      }
    }
  }
}