You are here

public function LingotekEntity::getTitle in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekEntity.php \LingotekEntity::getTitle()
  2. 7.6 lib/Drupal/lingotek/LingotekEntity.php \LingotekEntity::getTitle()

Overrides LingotekTranslatableEntity::getTitle

3 calls to LingotekEntity::getTitle()
LingotekEntity::getDescription in lib/Drupal/lingotek/LingotekEntity.php
LingotekEntity::getDocumentName in lib/Drupal/lingotek/LingotekEntity.php
LingotekEntity::getNote in lib/Drupal/lingotek/LingotekEntity.php

File

lib/Drupal/lingotek/LingotekEntity.php, line 269
Defines LingotekEntity.

Class

LingotekEntity
A class wrapper for Lingotek-specific behavior on nodes.

Code

public function getTitle() {
  if (!empty($this->title)) {
    return $this->title;
  }
  if (!empty($this->info['entity keys']['label']) && !empty($this->entity->{$this->info['entity keys']['label']})) {
    $this->title = $this->entity->{$this->info['entity keys']['label']};
  }
  elseif ($this->entity_type == 'comment') {
    $this->title = $this->entity->subject;
  }
  else {
    LingotekLog::info('Did not find a label for @entity_type #!entity_id, using default label.', array(
      '@entity_type' => $this->entity_type,
      '@entity_id' => $this->entity_id,
    ));
    $this->title = $this->entity_type . " #" . $this->entity_id;
  }
  return $this->title;
}