You are here

function title_entity_view_alter in Title 8.2

Implements hook_entity_view_alter().

File

./title.module, line 93
Convert titles into fields which can be display manipulated.

Code

function title_entity_view_alter(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
  if ($entity
    ->getEntityTypeId() != 'node') {
    return;
  }
  $config_manager = \Drupal::service('title.config_manager');
  if (!$config_manager
    ->getEnabled($entity
    ->bundle())) {
    return;
  }
  if (isset($display
    ->getComponent('title')['hidden'])) {
    $build['title']['#title_hidden'] = TRUE;
  }
}