You are here

function _civicrm_entity_labels in CiviCRM Entity 7.2

Same name and namespace in other branches
  1. 7 civicrm_entity.module \_civicrm_entity_labels()

Provide label (column) for each entity types - default to id if nothing specified.

@TODO Use the CiviCRM 4.5 getlist function - possibly ported into this module to support 4.4

Parameters

$entity:

Return value

string

See also

http://api.drupal.org/api/drupal/modules!system!system.api.php/function/...

2 calls to _civicrm_entity_labels()
civicrm_entity_entity_info in ./civicrm_entity.module
Here we declare selected CiviCRM entities to Drupal.
_civicrm_entity_get_title in ./civicrm_entity.module
Title callback

File

./civicrm_entity.module, line 2104

Code

function _civicrm_entity_labels($entity) {
  $civicrm_entity_info = civicrm_entity_get_supported_entity_info();
  $labels = array();
  foreach ($civicrm_entity_info as $drupal_entity => $data) {
    if (isset($data['label property']) && $data['label property'] != '') {
      $labels[$drupal_entity] = $data['label property'];
    }
  }
  _civicrm_enabled_entity_alter_labels($labels);
  return isset($labels[$entity]) ? $labels[$entity] : 'id';
}