You are here

public function pcp_handler_field_profile_completeness::render in Profile Complete Percent 7

Render data.

Parameters

object $values: Object having information about pcp.

Return value

Render data.

Overrides views_handler_field::render

File

includes/pcp_handler_field_profile_completeness.inc, line 67
Handler for the 'Profile: completeness' field. This is for Profile2 profiles.

Class

pcp_handler_field_profile_completeness
@file Handler for the 'Profile: completeness' field. This is for Profile2 profiles.

Code

public function render($values) {
  $profile2_entity = entity_get_info('profile2');
  $bundle = empty($this->options['bundle']) ? key($profile2_entity['bundles']) : $this->options['bundle'];
  if (!empty($profile2_entity['bundles'][$bundle])) {
    $user = new stdClass();
    $user->uid = $values->{$this->aliases['uid']};
    $data = pcp_get_complete_percentage_data('profile2', $bundle, $user);
    return $data['current_percent'];
  }
  return '?';
}