ManageDisplayNodeViewController.php in Manage display 8
File
modules/manage_display_fix_title/src/Controller/ManageDisplayNodeViewController.php
View source
<?php
namespace Drupal\manage_display_fix_title\Controller;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\node\Controller\NodeViewController;
class ManageDisplayNodeViewController extends NodeViewController {
public function buildTitle(array $page) {
$entity_type = $page['#entity_type'];
$entity = $page['#' . $entity_type];
if ($entity instanceof FieldableEntityInterface) {
$label_field = $entity
->getEntityType()
->getKey('label');
if ($label_field) {
$page_title = [
'#theme' => 'entity_page_title',
'#title' => $entity
->label(),
'#entity' => $entity,
'#view_mode' => $page['#view_mode'],
];
$page['#title'] = $this->renderer
->render($page_title);
unset($page[$label_field]);
}
}
return $page;
}
}