diff --git a/features.module b/features.module index 6aeb2d7..7d59906 100644 --- a/features.module +++ b/features.module @@ -482,6 +482,20 @@ function features_get_components($component = NULL, $key = NULL, $reset = FALSE) } else { $components = module_invoke_all('features_api'); + + // If this component specifies a default hook that also has a 'grouping' + // specified in module_hook_info(), then use the group name as the custom + // filename since it will automatically be included by module_invoke(). + $hook_info = module_hook_info(); + foreach ($components as &$component) { + if (!empty($component['default_hook']) && !isset($component['default_file']) && empty($component['default_filename'])) { + if (isset($hook_info[$component['default_hook']]['group'])) { + $component['default_file'] = FEATURES_DEFAULTS_CUSTOM; + $component['default_filename'] = $hook_info[$component['default_hook']]['group']; + } + } + } + drupal_alter('features_api', $components); cache_set('features_api', $components); }