function webform_components in Webform 5.2
Same name and namespace in other branches
- 6.3 webform.module \webform_components()
- 7.4 webform.module \webform_components()
- 7.3 webform.module \webform_components()
Menu callback for node/[nid]/components.
1 string reference to 'webform_components'
- webform_menu in ./
webform.module - Implementation of hook_menu().
File
- ./
webform.module, line 2131
Code
function webform_components($node, $cid = NULL, $op = 'edit') {
include_once drupal_get_path('module', 'webform') . '/webform_components.inc';
$components = webform_load_components();
if (isset($node->webform['components'][$cid]) || $cid == 'new') {
if ($op == 'delete') {
return drupal_get_form('webform_component_delete_form', $node, $node->webform['components'][$cid]);
}
elseif ($cid == 'new' && in_array($op, array_keys($components))) {
$component = array(
'type' => $op,
'name' => $_GET['name'],
'mandatory' => $_GET['mandatory'],
'email' => $_GET['email'],
'pid' => $_GET['pid'],
'weight' => $_GET['weight'],
);
webform_component_defaults($component);
return drupal_get_form('webform_component_edit_form', $node, $component);
}
elseif (isset($node->webform['components'][$cid]) && $op == 'clone') {
$component = $node->webform['components'][$cid];
webform_component_defaults($component);
return drupal_get_form('webform_component_edit_form', $node, $component, TRUE);
}
elseif (isset($node->webform['components'][$cid])) {
$component = $node->webform['components'][$cid];
webform_component_defaults($component);
return drupal_get_form('webform_component_edit_form', $node, $component);
}
}
return drupal_get_form('webform_components_form', $node);
}