You are here

function profile2_page_uri_callback in Profile 2 7

Same name and namespace in other branches
  1. 7.2 contrib/profile2_page.module \profile2_page_uri_callback()

URI callback pointing to the profile page.

See also

profile2_pages_entity_info_alter()

1 string reference to 'profile2_page_uri_callback'
profile2_page_entity_info_alter in contrib/profile2_page.module
Implements hook_entity_info_alter().

File

contrib/profile2_page.module, line 254
Adds separate pages for viewing and editing profiles.

Code

function profile2_page_uri_callback($profile) {
  $type = $profile
    ->type();
  if (!empty($type->data['use_page'])) {
    return array(
      'path' => profile2_page_get_base_path($type) . '/' . $profile->uid,
    );
  }
  else {
    if (!empty($type->data['use_tab'])) {
      return array(
        'path' => "user/{$profile->uid}/view/{$profile->type}",
      );
    }
  }

  // Fall back to the default callback.
  return $profile
    ->defaultUri();
}