You are here

function features_invoke in Features 7.2

Same name and namespace in other branches
  1. 6 features.module \features_invoke()
  2. 7 features.module \features_invoke()

Invoke a component callback.

@todo Explicitly return NULL if hook not found, replace the 'void' doc.

Parameters

string $component: Component name, e.g. 'field_instance'.

string $callback: Component hook name, e.g. 'features_revert'.

Return value

mixed|void The return value from the component hook callback. If the callback does not exist, NULL ("void") is returned.

5 calls to features_invoke()
features_export_render_hooks in ./features.export.inc
Generate an array of hooks and their raw code.
features_get_normal in ./features.export.inc
Get normal objects for a given module/component pair.
_drush_features_component_list in ./features.drush.inc
Returns all component item labels, grouped by component type.
_features_export_build in ./features.admin.inc
Return the full feature export array based upon user selections in form_state.
_features_restore in ./features.module
Restore the specified modules to the default state.

File

./features.module, line 709
Main *.module file for the 'features' module.

Code

function features_invoke($component, $callback) {
  $args = func_get_args();
  unset($args[0], $args[1]);

  // Append the component name to the arguments.
  $args[] = $component;
  if ($function = features_hook($component, $callback)) {
    return call_user_func_array($function, $args);
  }
}