function profile2_regpath_block_view in Profile2 Registration Path 7.2
Implements hook_block_view().
File
- profile2_regpath_blocks/
profile2_regpath_blocks.module, line 28 - Create unique registration blocks per Profile2 profile type.
Code
function profile2_regpath_block_view($delta = '') {
global $user;
// set $block to NULL so that we have something to return for authenticated users.
$block = NULL;
switch ($delta) {
// Generate content for each profile2 profile type's pcp block.
default:
// Hide the block content from authenticated users.
if (!$user->uid) {
$profile_id = (int) str_replace('p2rp_register_', '', $delta);
$profile_entity = entity_load('profile2_type', array(
$profile_id,
));
if ($profile_type = reset($profile_entity)) {
module_load_include('inc', 'profile2_regpath', 'registration_form');
$block['subject'] = t('Register as @label', array(
'@label' => $profile_type->label,
));
$block['content'] = profile2_regpath_build_block_form($profile_type);
}
}
break;
}
return $block;
}