You are here

function rules_item_rule_set_export in Rules 6

Item type callback: When exporting a rule set, add its rules to the export.

File

rules/rules.export.inc, line 25
Provides export functionality and integrates with the features module.

Code

function rules_item_rule_set_export($set_name, &$rule_set, &$export, $module = NULL) {
  $rules = rules_get_configured_items('rules');
  foreach ($rules as $name => $rule) {
    if ($rule['#set'] == $set_name) {
      $export['rules'][$name] = $rule;
      rules_item_type_invoke('rules', 'export', array(
        $name,
        &$export['rules'][$name],
        &$export,
        $module,
      ));
    }
  }
  if (!empty($module)) {

    // Add the module name as category.
    $rule_set += array(
      'categories' => array(),
    );
    $rule_set['categories'][$module] = $module;
    $rule_set['status'] = 'default';
  }
}