Error - Call to a member function getTitle() in hook_preprocess_breadcrumb

Created on 22 March 2017, over 7 years ago
Updated 23 August 2023, 10 months ago

Fatal error: Call to a member function getTitle() on string in D:\Backup\htdocs\bornbook\themes\news_zymphonies_theme\news_zymphonies_theme.theme on line 283

if(($node = \Drupal::routeMatch()->getParameter('node')) && $variables['breadcrumb']){
$nodeDetails = node_load($node);
$variables['breadcrumb'][] = array(
'text' => $nodeDetails->get('title')->value,
'url' => $nodeDetails->get('url')->value
);
}

instead of

if(($node = \Drupal::routeMatch()->getParameter('node')) && $variables['breadcrumb']){
$variables['breadcrumb'][] = array(
'text' => $node->getTitle(),
'url' => $node->URL()
);
}

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India selvakumar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.69.0 2024