You are here

function hook_webform_component_presave in Webform 7.4

Same name and namespace in other branches
  1. 6.3 webform.api.php \hook_webform_component_presave()
  2. 7.3 webform.api.php \hook_webform_component_presave()

Modify a Webform component before it is saved to the database.

Note that most of the time this hook is not necessary, because Webform will automatically add data to the component based on the component form. Using hook_form_alter() will be sufficient in most cases.

Parameters

$component: The Webform component being saved.

See also

hook_form_alter()

webform_component_edit_form()

Related topics

2 invocations of hook_webform_component_presave()
webform_component_insert in includes/webform.components.inc
Insert a new component into the database.
webform_component_update in includes/webform.components.inc
Update an existing component with new values.

File

./webform.api.php, line 307
Sample hooks demonstrating usage in Webform.

Code

function hook_webform_component_presave(&$component) {
  $component['extra']['new_option'] = 'foo';
}