function _webform_edit_node in Webform Node Element 6
Same name and namespace in other branches
- 7 components/node.inc \_webform_edit_node()
Implements _webform_edit_component().
File
- components/
node.inc, line 42 - Webform module node component.
Code
function _webform_edit_node($component) {
$form = array();
$form['value'] = array(
'#type' => 'textfield',
'#size' => 5,
'#title' => t('Node'),
'#default_value' => $component['value'],
'#description' => t('Enter a valid node id, whose body will be shown as markup in the webform.') . theme('webform_token_help'),
'#weight' => -1,
'#element_validate' => array(
'_webform_edit_validate_node',
),
);
$form['extra']['nid'] = array(
'#type' => 'hidden',
'#default_value' => $component['extra']['nid'],
);
$form['extra']['view_mode'] = array(
'#type' => 'radios',
'#title' => t('Display Mode'),
'#default_value' => $component['extra']['view_mode'],
'#description' => t('Choose how you want the referenced node to be displayed.'),
'#options' => array(
TRUE => t('Display the node teaser'),
FALSE => t('Display the full node body'),
),
);
$form['extra']['title'] = array(
'#type' => 'checkbox',
'#title' => t('Override Title'),
'#default_value' => $component['extra']['title'],
'#description' => t('If checked, the title of the referenced node will be used as the component label.'),
'#options' => array(
0,
1,
),
);
$form['extra']['description'] = array();
$form['display'] = array(
'#type' => 'markup',
);
// Hide the display options.
// If ctools is present, use node title autocomplete.
if (module_exists('ctools')) {
$form['value']['#description'] = t('Enter a valid node id, or start typing to find the node whose body will be shown as markup in the webform.') . theme('webform_token_help');
$form['value']['#autocomplete_path'] = 'ctools/autocomplete/node';
unset($form['value']['#size']);
}
return $form;
}