You are here

function profile2_page_field_extra_fields in Profile 2 7.2

Implements hook_field_extra_fields().

Adds a pseudo-field that displays links to profiles with separate pages. Create the field if there is at least one profile that uses page mode.

File

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

Code

function profile2_page_field_extra_fields() {
  $extra = array();
  foreach (profile2_get_types() as $type_name => $type) {

    // Appears on: admin/config/people/accounts/display
    if (!empty($type->data['use_page'])) {
      $extra['user']['user']['display']['profile_pages'] = array(
        'label' => t('Profile pages'),
        'weight' => 0,
      );

      // Only need to create one field.
      break;
    }
  }
  return $extra;
}