You are here

function formblock_get_block in Form Block 5

Same name and namespace in other branches
  1. 6 formblock.module \formblock_get_block()
  2. 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 87

Code

function formblock_get_block($type) {
  if (node_access('create', $type)) {

    // Note title before rendering of form.
    $title = drupal_get_title();
    $form = node_add($type);
    $types = node_get_types('names');

    // Restore title, which will have been overridden.
    drupal_set_title($title);
    return array(
      'subject' => t('@type form', array(
        '@type' => $types[$type],
      )),
      'content' => $form,
    );
  }
}