Download & Extend

Load in component default file and filename from hook_hook_info() if available

Project:Features
Version:7.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

Let's say I've got a custom module with the following code:

<?php
/**
* Implements hook_hook_info().
*/
function mymodule_hook_info() {
 
$info = array();
 
$info['mymodule_item_info'] = array('group' => 'mymodule');
 
$info['mymodule_item_info_alter'] = array('group' => 'mymodule');
  return
$info;
}

/**
* Implements hook_features_api().
*/
function mymodule_features_api() {
  return array(
   
'mymodule_item' => array(
     
'name' => 'My module items',
     
'feature_source' => TRUE,
     
'default_hook' => 'mymodule_item_info',
     
'alter_hook' => 'mymodule_item_info',
    ),
  );
}
?>

The first hook allows all implementations of hook_mymodule_item_info and hook_mymodule_item_alter() to be placed in modulename.group-value.inc and be automatically included via module_invoke and module_invoke_all, which is awesome. It would be nice if Features could automatically tell that since I've provided my default hook, that it should attempt to set default_file to FEATURES_DEFAULTS_CUSTOM, and default_filename to the group string.

Comments

#1

Status:active» needs review
AttachmentSizeStatusTest resultOperations
1900668-default-file-and-filename-from-hook-hook-info.patch1.1 KBIgnoredNoneNone

#5

Sorry about the unrelated comments, posted in wrong issue. I deleted them.