public function NodeHierarchyController::getTitle in Entity Reference Hierarchy 8
1 string reference to 'NodeHierarchyController::getTitle'
File
- src/
Controller/ NodeHierarchyController.php, line 18 - Contains \Drupal\entity_hierarchy\Controller\NodeHierarchyController.
Class
- NodeHierarchyController
- Controller routines for book routes.
Namespace
Drupal\entity_hierarchy\ControllerCode
public function getTitle() {
// Is there really no better way to do this?
$url = \Drupal\Core\Url::fromRoute('<current>');
$curr_path = $url
->toString();
$path = explode('/', $curr_path);
$nid = $path[2];
$node = Node::load($nid);
if (is_object($node)) {
return t('Children of %t', array(
'%t' => $node
->getTitle(),
));
}
}