Would be nice if commons fields (like Radioactivity and Follow) offer a way to disable them on existing features.
For instance, take the Poll module:
<?php/**
* Implements hook_commons_entity_integration.
*/
function commons_polls_commons_entity_integration() {
return array(
'node' => array(
'poll' => array(
),
),
);
}}?>
Currently, there is no way to change this to the following without changing the module:
<?php/**
* Implements hook_commons_entity_integration.
*/
function commons_polls_commons_entity_integration() {
return array(
'node' => array(
'poll' => array(
'exclude_commons_follow' => TRUE,
),
),
);
}?>
This could be achieved by giving modules the change to alter the hook_commons_entity_integration outcome by changing this:
<?php
function commons_follow_flag_alter(&$flag) {
$commons_entity_integrations = module_invoke_all('commons_entity_integration');
...
}
?>
to
<?php
function commons_follow_flag_alter(&$flag) {
$commons_entity_integrations = module_invoke_all('commons_entity_integration');
drupal_alter('commons_entity_integration', $commons_entity_integrations);
...
}
?>
Comments
Comment #1
BarisW commentedHere's a first stab. I've introduced a helper function in commons_misc so not all submodules have to implement the alter themselves.
This enables us to change implementations by adding a function like this:
Comment #2
BarisW commentedBump.
Comment #3
mpaler commentedWhat's the status with this code proposal? Has it gained any traction? Has an alternative method taken hold?
Specifically, I'm looking for a way to groups integration/requirement for a commons integrated custom content type.
Mike
Comment #4
devin carlson commentedThanks for the patch!
Attached is an updated patch that:
Comment #5
ezra-g commentedThe approach in #4 looks solid to me. Thanks, Devin Carlson!
Comment #6
devin carlson commentedTested #4 with both a fresh and an existing Commons install and didn't run into any errors or issues with entity integrations not functioning. I was also able to alter existing integrations by implementing the new alter hook.
Committed #4 to Commons 7.x-3.x.
http://drupalcode.org/project/commons.git/commit/4237275