You are here

public function TMGMTMessage::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.message.inc, line 87

Class

TMGMTMessage
Entity class for the tmgmt_message entity.

Code

public function defaultLabel() {
  $created = format_date($this->created);
  switch ($this->type) {
    case 'error':
      return t('Error message from @time', array(
        '@time' => $created,
      ));
    case 'status':
      return t('Status message from @time', array(
        '@time' => $created,
      ));
    case 'warning':
      return t('Warning message from @time', array(
        '@time' => $created,
      ));
    case 'debug':
      return t('Debug message from @time', array(
        '@time' => $created,
      ));
  }
}