You are here

function _civicrm_entity_get_title in CiviCRM Entity 7.2

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

Title callback

Parameters

$field_specs:

string $entity_type:

Return value

string

2 calls to _civicrm_entity_get_title()
civicrm_entity_get_schema in ./civicrm_entity.module
Get schema for entities.
_civicrm_entity_getproperties in ./civicrm_entity.module
Calculate fields for entities

File

./civicrm_entity.module, line 2734

Code

function _civicrm_entity_get_title($field_specs, $entity_type = '') {
  if (!empty($entity_type)) {
    $label_field = _civicrm_entity_labels($entity_type);
  }
  else {
    $label_field = 'title';
  }
  if (empty($field_specs[$label_field])) {
    if (array_key_exists('label', $field_specs)) {
      $label_field = 'label';
    }
    else {
      if (array_key_exists('name', $field_specs)) {
        $label_field = 'name';
      }
    }
  }
  $label = $field_specs[$label_field];
  if (!empty($field_specs['groupTitle'])) {
    $label = $field_specs['groupTitle'] . ': ' . $label;
  }
  return empty($label) ? 'Title not defined in schema' : $label;
}