function RulesFeaturesController::export

Generates the result for hook_features_export().

Overridden to add in rules-specific stuff.

File

./rules.features.inc, line 30

Class

RulesFeaturesController
Controller handling the features integration.

Code

public function export($data, &$export, $module_name = '') {
    $pipe = parent::export($data, $export, $module_name);
    foreach (entity_load_multiple_by_name($this->type, $data) as $name => $rules_config) {
        // Add in the dependencies.
        $export['dependencies'] += drupal_map_assoc($rules_config->dependencies());
        // Add in plugin / element specific additions.
        $iterator = new RecursiveIteratorIterator($rules_config, RecursiveIteratorIterator::SELF_FIRST);
        foreach ($iterator as $element) {
            if ($element->facesAs('RulesPluginFeaturesIntegrationInterface')) {
                // Directly use __call() so we can pass $export by reference.
                $element->__call('features_export', array(
                    &$export,
                    &$pipe,
                    $module_name,
                ));
            }
        }
    }
    return $pipe;
}