You are here

function certificate_snapshot_entity_info_label in Certificate 7.3

Entity label callback.

Provide a custom label for better UX.

1 string reference to 'certificate_snapshot_entity_info_label'
certificate_entity_info in ./certificate.module
Certificate Entity Support

File

./certificate.module, line 997
Certificate module.

Code

function certificate_snapshot_entity_info_label($entity, $entity_type) {
  $certificate = entity_load_single('certificate', $entity->cid);
  $acct = user_load($entity->uid);
  $course = course_load($entity->nid);
  $tokens = array(
    '!title' => $certificate ? $certificate->title : 'None',
    '!nid' => $course->nid,
    '!node_type' => $course->type,
    '!name' => $acct ? $acct->name : t('Missing user !uid', array(
      '!uid' => $entity->uid,
    )),
    '!mail' => $acct ? $acct->mail : NULL,
    '!date' => format_date($entity->date, 'custom', 'c'),
  );
  $label = t('!name !mail in !node_type !nid using template !title (!date)', $tokens);
  return $label;
}