MenuLinkContent getTitle & getDescription should handle exceptions

Created on 11 June 2025, 28 days ago

Problem/Motivation

In \Drupal\menu_link_content\Plugin\Menu\MenuLinkContent getTitle() & getDescription() both call getEntity().

getEntity can throw a PluginException, which if thrown will take the whole site offline.

Both of these methods have fallback values, so if it's not possible to get the entity the fallback value should be returned instead of throwing a fatal error.

Steps to reproduce

I encountered this after a failed production deployment. I am not sure exactly what caused the error as I quickly rolled the deployment back.

Proposed resolution

Add try catch in getTitle and getDescription.

📌 Task
Status

Active

Version

10.2

Component

menu system

Created by

🇬🇧United Kingdom dahousecat

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024