You are here

protected function Entityform::defaultLabel in Entityform 7.2

Same name and namespace in other branches
  1. 7 entityform.module \Entityform::defaultLabel()

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

./entityform.module, line 1087
Module for the Entityform Entity - a starting point to create your own Entity and associated administration interface

Class

Entityform
The class used for entityform entities

Code

protected function defaultLabel() {
  $entityform_type = entityform_type_load($this->type);
  $label = $entityform_type->label;
  $submit_user = NULL;
  if (!empty($this->uid)) {
    $submit_user = user_load($this->uid);
  }
  $label .= ' - ' . format_username($submit_user);
  $label .= ' - ' . format_date($this->created, 'short');
  return $label;
}