Error: Call to a member function getOption() on null

Created on 29 November 2021, over 2 years ago
Updated 13 June 2024, 13 days ago

When the module is enabled it brings fatal error.

Error: Call to a member function getOption() on null in Drupal\menu_link_destination\MenuLinkDestination::preRenderLink() (line 35 of modules/contrib/menu_link_destination/src/MenuLinkDestination.php).

The problem is in preRenderLink method. Sometimes $url = $element['#url']; is empty.
It appears in Drupal 9.2.9 version.

Also, there is another moment I believe has a mistake.
In module file there is menu_link_destination_form_menu_link_content_menu_link_content_form_alter form alter. However, I think it should be menu_link_destination_form_menu_link_content_form_alter.

Attached simple patch that fixes these errors and the module works fine.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇦Canada v1nk Vancouver

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

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.69.0 2024