Problem/Motivation

After adding an entity reference from a media library widget, the following error is appearing:

Passing null to parameter #1 ($url) of type string is deprecated in /var/www/html/web/modules/contrib/linked_entity_reference/src/Plugin/Field/FieldWidget/LinkedEntityReferenceWidgetTrait.php on line 35

This happens because the URI property is not available when it comes to print it,

Steps to reproduce

Create a linked entity reference field type that references medias.

Proposed resolution

When URI is not available , build it from the entity the field is referencing.

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

omarlopesino created an issue. See original summary.

omarlopesino’s picture

Status: Active » Needs review

I've created a MR that fix the issue. Please review, thanks!

alzz’s picture

Status: Needs review » Reviewed & tested by the community

Checked and it fixes completely the bug.

tunic’s picture

  • tunic committed cd0f3dc9 on 1.0.x authored by omarlopesino
    Issue #3371059: Passing null to parameter #1 ($url) of type string is...
tunic’s picture

Merged, thanks!

tunic’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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