function webform_component_defaults in Webform 6.2
Same name and namespace in other branches
- 5.2 webform_components.inc \webform_component_defaults()
- 6.3 includes/webform.components.inc \webform_component_defaults()
- 7.4 includes/webform.components.inc \webform_component_defaults()
- 7.3 includes/webform.components.inc \webform_component_defaults()
Populate a component with the defaults for that type.
2 calls to webform_component_defaults()
- webform_load in ./
webform.module - Implementation of hook_load().
- webform_menu_component_load in ./
webform.module - Menu loader callback. Load a webform component if the given cid is a valid.
File
- ./
webform_components.inc, line 585 - Webform module components handling.
Code
function webform_component_defaults(&$component) {
webform_load_components();
$function = '_webform_defaults_' . $component['type'];
if (function_exists($function)) {
$defaults = $function();
foreach ($defaults as $key => $default) {
if (!isset($component[$key])) {
$component[$key] = $default;
}
}
foreach ($defaults['extra'] as $extra => $default) {
if (!isset($component['extra'][$extra])) {
$component['extra'][$extra] = $default;
}
}
}
}