You are here

public function TMGMTJobItem::defaultLabel in Translation Management Tool 7

Defines the entity label if the 'entity_class_label' callback is used.

Specify 'entity_class_label' as 'label callback' in hook_entity_info() to let the entity label point to this method. Override this in order to implement a custom default label.

Overrides Entity::defaultLabel

File

entity/tmgmt.entity.job_item.inc, line 137

Class

TMGMTJobItem
Entity class for the tmgmt_job entity.

Code

public function defaultLabel() {
  if ($controller = $this
    ->getSourceController()) {
    $label = $controller
      ->getLabel($this);
  }
  else {
    $label = parent::defaultLabel();
  }
  if (strlen($label) > TMGMT_JOB_LABEL_MAX_LENGTH) {
    $label = truncate_utf8($label, TMGMT_JOB_LABEL_MAX_LENGTH, TRUE);
  }
  return $label;
}