Problem/Motivation

When using the menu_link_label data producer with a link, the user has no access to, ith throws an Internal server error.
The feason for that is, that MenuLinkLabel::resolve declares the return type to be string, but in case of an inaccessible link $link->getTitle() returns TranslatableMarkup.

Proposed resolution

Either cast the return value to string, or change the return type declaration to string|TranslatableMarkup.

Issue fork graphql-3525994

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

daniel.bosen created an issue. See original summary.

daniel.bosen’s picture

Status: Active » Needs review
klausi’s picture

Status: Needs review » Fixed

Thanks! I think casting to string here is ok as the result of a dataproducer should probably not be a Translatable markup object.

  • klausi committed df970abb on 5.x authored by daniel.bosen
    fix(MenuLinkLabel): Cast any translatable label to string (#3525994 by...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.