class RulesFeaturesController

Controller handling the features integration.

Hierarchy

Expanded class hierarchy of RulesFeaturesController

1 string reference to 'RulesFeaturesController'
rules_entity_info in ./rules.module
Implements hook_entity_info().

File

./rules.features.inc, line 13

View source
class RulesFeaturesController extends EntityDefaultFeaturesController {
    
    /**
     * Defines the result for hook_features_api().
     */
    public function api() {
        $info = parent::api();
        $info['rules_config']['default_file'] = FEATURES_DEFAULTS_CUSTOM;
        $info['rules_config']['default_filename'] = 'rules_defaults';
        return $info;
    }
    
    /**
     * Generates the result for hook_features_export().
     *
     * Overridden to add in rules-specific stuff.
     */
    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;
    }

}

Members

Title Sort descending Modifiers Object type Summary
RulesFeaturesController::api public function Defines the result for hook_features_api().
RulesFeaturesController::export public function Generates the result for hook_features_export().