function afb_get_add_block in Advanced Form Block 7
Generate a block containing a node entry form.
1 call to afb_get_add_block()
- afb_block_view in ./
afb.module - Implements hook_block_view().
File
- ./
afb.module, line 666 - Allows administrators to create blockd of node add/edit forms.
Code
function afb_get_add_block($delta) {
$block_info = afb_get_node_form_block_data($delta);
$type = $block_info->content_type;
if (node_access('create', $type)) {
global $user;
$block = array();
module_load_include('inc', 'node', 'node.pages');
$node = (object) array(
'uid' => $user->uid,
'name' => isset($user->name) ? $user->name : '',
'type' => $type,
'language' => LANGUAGE_NONE,
'ajax_form' => '1',
);
$node->delta = $delta;
$form = drupal_get_form($type . '_node_form', $node);
$block['subject'] = t('@type form', array(
'@type' => $type,
));
$block['content']['form'] = $form;
return $block;
}
}