diff --git a/includes/features.ctools.inc b/includes/features.ctools.inc index 83a59b4..0ce0455 100644 --- a/includes/features.ctools.inc +++ b/includes/features.ctools.inc @@ -21,6 +21,9 @@ foreach (_ctools_features_get_info() as $component => $info) { if (!function_exists("{$component}_features_revert")) { $code .= 'function '. $component .'_features_revert($module) { return ctools_component_features_revert("'. $component .'", $module); }'; } + if (!function_exists("{$component}_features_consolidate")) { + $code .= 'function '. $component .'_features_consolidate($items=array(),$module="",$component="") { return ctools_component_features_consolidate($component, $items, $module); }'; + } eval($code); } @@ -193,6 +196,19 @@ function ctools_component_features_revert($component, $module) { } /** + * Master implementation of hook_features_consolidate() for all ctools components. + */ +function ctools_component_features_consolidate($component, $items, $module) { + foreach ($items as $object_name) { + if ($object = _ctools_features_export_crud_load($component, $object_name)) { + if (!empty($object->in_code_only)) { + _ctools_features_export_crud_save($component, $object); + } + } + } +} + +/** * Helper function to return various ctools information for components. */ function _ctools_features_get_info($identifier = NULL, $reset = FALSE) { @@ -252,6 +268,15 @@ function _ctools_features_get_info($identifier = NULL, $reset = FALSE) { } /** + * Wrapper around ctools_export_crud_save() - no < 1.7 compatibility. + */ +function _ctools_features_export_crud_save($table, $object) { + if (ctools_api_version('1.7')) { + return ctools_export_crud_save($table, $object); + } +} + +/** * Wrapper around ctools_export_crud_export() for < 1.7 compatibility. */ function _ctools_features_export_crud_export($table, $object, $indent = '') {