You are here

function form_builder_webform_component_invoke in Form Builder 7

Same name and namespace in other branches
  1. 6 modules/webform/form_builder_webform.module \form_builder_webform_component_invoke()
  2. 7.2 modules/webform/form_builder_webform.module \form_builder_webform_component_invoke()

Invoke a form builder callback for a webform component.

If the webform component implements the callback itself, this function returns the result obtained from that. Otherwise, if this module has a default implementation of the callback on behalf of the component, the result obtained from that is returned.

Parameters

$component_type: The component type as a string.

$callback: The callback to execute.

...: Any additional parameters required by the $callback.

7 calls to form_builder_webform_component_invoke()
FormBuilderWebformForm::addComponents in modules/webform/form_builder_webform.classes.inc
Add components to the form.
FormBuilderWebformForm::getComponent in modules/webform/form_builder_webform.classes.inc
Create a webform component array based the form_builder cache.
form_builder_webform_form_builder_element_types in modules/webform/form_builder_webform.module
Implements hook_form_builder_element_types().
form_builder_webform_form_builder_preview_alter in modules/webform/form_builder_webform.module
Implements hook_form_builder_preview_alter().
form_builder_webform_form_builder_properties in modules/webform/form_builder_webform.module
Implements hook_form_builder_properties().

... See full list

File

modules/webform/form_builder_webform.module, line 338
Form Builder integration for the Webform module.

Code

function form_builder_webform_component_invoke($component_type, $callback) {
  $args = func_get_args();

  // First try invoking the callback in the webform component itself.
  $result = call_user_func_array('webform_component_invoke', $args);
  if (isset($result)) {
    return $result;
  }

  // Otherwise look for a default implementation provided by this module.
  $component_type = array_shift($args);
  $callback = array_shift($args);
  $function = '_form_builder_webform_' . $callback . '_' . $component_type;
  module_load_include('inc', 'form_builder_webform', 'form_builder_webform.components');
  if (function_exists($function)) {
    return call_user_func_array($function, $args);
  }
}