While working on this issue to add the proper dependency discovery for i18n_taxonomy, I tried to add the dependency as described in the features.api.php file.

/**
 * Alter the pipe array for a given component. This hook should be implemented
 * with the name of the component type in place of `component` in the function
 * name, e.g. `features_pipe_views_alter()` will alter the pipe for the Views
 * component.
 *
 * @param array &$pipe
 *   By reference. The pipe array of further processors that should be called.
 * @param array $data
 *   An array of machine names for the component in question to be exported.
 * @param array &$export
 *   By reference. An array of all components to be exported with a given
 *   feature.
 */
function hook_features_pipe_COMPONENT_alter(&$pipe, $data, $export) {
  if (in_array($data, 'my-node-type')) {
    $pipe['dependencies'][] = 'mymodule';
  }
}

First the function documentation is not reflection the definition. $export is documented as a reference which is not the case in the function definition.

I tried to add the module in dependency by using the $pipe['dependencies'] array as described in the function. The module was properly added to the dependency list but also removed all other dependencies.
The only was I have been able to add the dependency without altering previously declared dependencies was by using the $export['dependencies'] array (and use $export as a reference).

Am I missing something or should we update the documentation? I am a little bit confused as I have seen various other modules implementing it by using the $pipe variable as documented.

Thanks,

Comments

vbouchet created an issue.