Posted by ezra-g on December 17, 2012 at 6:37pm
2 followers
Jump to:
| Project: | Drupal Commons |
| Version: | 7.x-3.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | major |
| Assigned: | ezra-g |
| Status: | closed (fixed) |
Issue Summary
Commons Groups & Commons Radioactivity modules add field instances to content types defined by other modules.
We currently prevent these instances from appearing in exports of those modules by adding a features_exclude line to each module. We could instead use hook_features_pipe_alter() to prevent these items from being added to exports, similar to the way that og.module does so:
<?php
/**
* Implements hook_features_pipe_alter().
*
* Prevent OG related fields from being piped in features, when a content
* type that has them is selected.
*/
function og_features_pipe_alter(&$pipe, $data, $export) {
if (variable_get('og_features_ignore_og_fields', FALSE) || empty($pipe['field'])) {
return;
}
foreach ($pipe['field'] as $delta => $value) {
$args = explode('-', $value);
$field_name = $args[2];
if (og_fields_info($field_name) || og_is_group_audience_field($field_name)) {
unset($pipe['field'][$delta]);
}
}
}
?>
Comments
#1
I tested by doing a drush fu on Commons Posts and the og_group_ref, group_privacy, and field_radioactivity field instances and bases are successfully excluded.
This simplifies incremental updates to Commons feature modules and simplifies the site builder and developer experience working with Commons by removing these fields from Features exports :).
http://drupalcode.org/project/commons_groups.git/commit/7c3facc
http://drupalcode.org/project/commons_radioactivity.git/commit/5fc9285
http://drupalcode.org/project/commons_groups.git/commit/b368d18
#2
Let's also get the field_target_* fields that Commons Follow defines.
#3
http://drupalcode.org/project/commons_follow.git/commitdiff/3d84bd3?hp=5....
Looks like we also want to get field_topics and field_body. I wonder about the extent to which this could be addressed as part of #1064472: separate fields from field instances.
#4
#5
Followup commit to correct a function name: http://drupalcode.org/project/commons_follow.git/commit/71b550e
#6
I don't see any remaining action items here - Let's file new issues for followup items.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.