function formblock_get_block in Form Block 6
Same name and namespace in other branches
- 5 formblock.module \formblock_get_block()
- 7 formblock.module \formblock_get_block()
Generate a block containing a node entry form.
1 call to formblock_get_block()
- formblock_block in ./
formblock.module - Implementation of hook_block().
File
- ./
formblock.module, line 117
Code
function formblock_get_block($type) {
if (node_access('create', $type) && variable_get('formblock_expose_' . $type, 0)) {
// Include page handler for node_add()
module_load_include('inc', 'node', 'node.pages');
// Note title before rendering of form.
$title = drupal_get_title();
$form = node_add($type);
// Restore title, which will have been overridden.
drupal_set_title($title);
$node_type = node_get_types('type', $type);
$help = '';
if (variable_get('formblock_show_help_' . $type, 0)) {
$help = !empty($node_type->help) ? '<p>' . filter_xss_admin($node_type->help) . '</p>' : '';
}
return array(
'subject' => t('@type form', array(
'@type' => $node_type->name,
)),
'content' => $help . $form,
);
}
}