Problem/Motivation

Currently each component type (field, default view, user permission, etc.) has its own alter hook. There's a ever expanding collection of identical hook implementations in include files, one for each component type, when a single general implementation would do.

Proposed resolution

Would require #1317054: Provide support for exporting of altering of components on features.

Remaining tasks

Complete #1317054: Provide support for exporting of altering of components.

User interface changes

None.

API changes

Implement a new hook.

CommentFileSizeAuthor
#3 features-universal-alter-1314700-3.patch731 bytesnedjo

Comments

mpotter’s picture

This is high on my list to work on. The key to the alter hook in Features Field Override is that it gets called at the end of the normal Field exportable code. Figuring out where to call this alter hook within Features itself is tricky. But I'd definitely like to get this call out of the override exportable if possible since it causes issues with porting older features that don't have it. Also, I'd rather not change every single exportable to add an alter hook if a more general method can be found.

nedjo’s picture

Title: Replace compontent type specific alters with a single universal alter » Provide a universal hook for altering default components
nedjo’s picture

StatusFileSize
new731 bytes

Draft patch attached.

nedjo’s picture

Title: Provide a universal hook for altering default components » Use a universal hook for altering default components
nedjo’s picture

Issue summary: View changes

Updated issue summary.

mpotter’s picture

Actually just solved this one. Newest patch to Features #1277854: Faciliate altering features, e.g., export field display settings separate from field data structure pushes the drupal_alter calls back into Features and takes them out of the specific exportables (like Field). Much cleaner now and no longer causes changes to be exported for existing features.

mpotter’s picture

Turns out that pushing the drupal_alter calls back into Features is not the correct solution. This only works for faux-exportables, such as Field. For a more "universal" solution, the drupal_alter call still needs to be made at the end of the actual exportable default_hook code.

Will be updating my sandbox and Features patch to reflect this later today and will post to the appropriate issue queues. Sorry for the confusion on my part...I was too focused on the specific Field override case, which is not representative of most other Features exports.

mpotter’s picture

Issue summary: View changes

Updating for issue on features.