In another module's implementation of hook_features_export_alter(), I'd like to be able to add attributes to my exported user roles. But currently features.user.inc implements its own custom hook_features_export_render() which hardcodes a single value into the exported object.
The attached patch changes the structure of the $export array produced by user_role_features_export() so that the exported data is a keyed array instead of just a single string, and changes user_role_features_export_render() to render the array contents rather than creating its own single-value array inside. The actual rendered output of user_role_features_export_render() is not affected unless another module implements hook_features_export_alter() and changes the $export['features']['user_role'] array contents.
| Comment | File | Size | Author |
|---|---|---|---|
| features-user_role-attributes-00.diff | 914 bytes | smokris |
Comments
Comment #1
smokrisHmm. When checking Features status, the
$datathat gets passed touser_role_features_export_render()is different — it isn't first passed throughhook_features_export_alter(). So usinghook_features_export_alter()to add user role data results in permanently-overridden features.Apparently
hook_features_export_alter()is only capable of cleanly removing Features Components, not modifying them?Comment #2
hefox commentedExport is for editing what becomes the .info file and tells features what to export, not the actual data being rendered.
There's a few other issues about changing the rendering process so it's easier to hook into it, so this is likely a duplicate of them. (Don't recall which ones).
Feature requests need to go into 7.x
Comment #3
smokrisAh, I see. Better documentation of what that hook is and isn't for would be helpful — I branched this issue to #1438212: Improve documentation for hook_features_export_alter().
Comment #4
smokrisAlso, I'll close this issue and await decision on the rendering process changes.