function webform_menu_component_load in Webform 7.4
Same name and namespace in other branches
- 6.3 webform.module \webform_menu_component_load()
- 6.2 webform.module \webform_menu_component_load()
- 7.3 webform.module \webform_menu_component_load()
Menu loader callback. Load a webform component if the given cid is a valid.
File
- ./
webform.module, line 494 - This module provides a simple way to create forms and questionnaires.
Code
function webform_menu_component_load($cid, $nid, $type) {
module_load_include('inc', 'webform', 'includes/webform.components');
if ($cid == 'new') {
$components = webform_components();
$component = in_array($type, array_keys($components)) ? array(
'type' => $type,
'nid' => $nid,
'name' => $_GET['name'],
'required' => $_GET['required'],
'pid' => $_GET['pid'],
'weight' => $_GET['weight'],
) : FALSE;
}
else {
$node = node_load($nid);
$component = isset($node->webform['components'][$cid]) ? $node->webform['components'][$cid] : FALSE;
}
if ($component) {
webform_component_defaults($component);
}
return $component;
}