Call to a member function isTranslatable() on null in Drupal\link\Plugin\Field\FieldWidget\LinkWidget::getUserEnteredStringAsUri() (line 119 of /var/www/html/docroot/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php)

Created on 8 January 2024, 12 months ago
Updated 2 February 2024, 11 months ago

Problem/Motivation

The error message "Call to a member function isTranslatable() on null" appears you are trying to call the isTranslatable() method on a null $node object.

Steps to reproduce

It is not possible to add a new Section teaser block on the Landing page and an error occurs. The entity browser does not open for image insert on the section teaser block.

Proposed resolution

The patch in the comment below includes checks for null before calling methods on the $node object and ensures that the $langcode is set before checking for translation. Additionally, it verifies that the node is loaded successfully before proceeding with further operations.

๐Ÿ› Bug report
Status

Needs work

Version

10.1 โœจ

Component
Entityย  โ†’

Last updated 3 days ago

  • Maintained by
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom @catch
  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland @berdir
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany @hchonov
Created by

๐Ÿ‡ง๐Ÿ‡ฌBulgaria rastepanyan

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024