function sheetnode_form in Sheetnode 5
Same name and namespace in other branches
- 6 sheetnode.module \sheetnode_form()
- 7.2 sheetnode.module \sheetnode_form()
- 7 sheetnode.module \sheetnode_form()
Implementation of hook_form().
File
- ./
sheetnode.module, line 63
Code
function sheetnode_form(&$node) {
$type = node_get_types('type', $node);
// Generate the default title and body.
$form = node_content_form($node, NULL);
// SocialCalc sheet.
$nid = $node->nid;
if (isset($_POST['sheetsave'])) {
$value = $_POST['sheetsave'];
}
else {
if (!empty($node->nid)) {
$value = _sheetnode_load($node->nid, $node->vid);
}
else {
if ($node->clone_from_original_nid) {
// support node_clone.module
$original_node = node_load($node->clone_from_original_nid);
$value = _sheetnode_load($original_node->nid, $original_node->vid);
$nid = $node->clone_from_original_nid;
}
else {
$value = '';
}
}
}
$output = _sheetnode_inject($value, 'edit-sheetsave', array(
'entity-name' => 'node',
'oid' => $nid,
));
$form['sheet']['sheetview'] = array(
'#value' => $output,
'#weight' => -1,
);
$form['sheet']['sheetsave'] = array(
'#type' => 'hidden',
);
// Template.
if (user_access('create sheet template')) {
$form['template'] = array(
'#type' => 'textfield',
'#title' => t('Save as template'),
'#description' => t('When saving this sheet, also keep a copy under the name you specify here. Later, this copy can be used as a template for other sheets.'),
'#required' => FALSE,
);
}
return $form;
}