function invite_block_view in Invite 7.4
Same name and namespace in other branches
- 7.2 invite.module \invite_block_view()
Implements hook_block_view().
File
- ./
invite.module, line 117
Code
function invite_block_view($delta) {
$type = str_replace('invite_add_', '', $delta);
// Return empty block for users who have no appropriate permissions.
if (!(user_access('create any invite entities') || user_access('create ' . $type . ' entity'))) {
return NULL;
}
module_load_include('inc', 'invite', 'includes/invite.admin');
$invite_type = invite_get_types($type);
$invite = entity_create('invite', array(
'type' => $type,
));
$block['subject'] = t('Create @name', array(
'@name' => entity_label('invite_type', $invite_type),
));
$block['content'] = drupal_get_form('invite_form', $invite);
return $block;
}