You are here

public function ContactController::getTitle in Email Contact 8

1 string reference to 'ContactController::getTitle'
email_contact.routing.yml in ./email_contact.routing.yml
email_contact.routing.yml

File

src/Controller/ContactController.php, line 18

Class

ContactController
Class ContactController.

Namespace

Drupal\email_contact\Controller

Code

public function getTitle($entity_type = NULL, $entity_id = NULL, $field_name = NULL, $view_mode = 'full') {
  if ($entity_id == NULL) {
    return '';
  }
  $entity = \Drupal::entityTypeManager()
    ->getStorage($entity_type)
    ->load($entity_id);
  $title = method_exists($entity, 'getTitle') ? $entity
    ->getTitle() . '  - Email Contact' : 'Email Contact';
  return $title;
}