You are here

function profile2_user_categories in Profile 2 7.2

Same name and namespace in other branches
  1. 7 profile2.module \profile2_user_categories()

Implements hook_user_categories().

File

./profile2.module, line 965
Support for configurable user profiles.

Code

function profile2_user_categories() {
  $data = array();
  foreach (profile2_get_types() as $type => $info) {
    if ($info->userCategory) {
      $data[] = array(
        'name' => $type,
        'title' => $info
          ->getTranslation('label'),
        // Add an offset so a weight of 0 appears right of the account category.
        'weight' => $info->weight + 3,
        'access callback' => 'profile2_category_access',
        'access arguments' => array(
          1,
          $type,
        ),
      );
    }
  }
  return $data;
}