Edit internal link and remove the URL breaks layout builder

Created on 3 March 2021, over 3 years ago
Updated 25 April 2023, over 1 year ago

Problem/Motivation

I have an issue with internal links, as If edit the link and remove the URL and save my changes on layout builder, it will show an error:
Drupal\Core\Entity\EntityStorageException: The "" entity type does not exist. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 846 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

So, I checked the issue and found that the link data attributes still exist but empty:
data-entity-substitution="" data-entity-type="" data-entity-uuid="" href=""

Note: I know that the user should use the Unlink button, but this case may happen on production by mistake if the user uses it in the wrong way.

Steps to reproduce

1- Edit the layout of any content that uses layout builder.
2- Add custom block.
3- Add internal link.
4- Edit the same link and remove the URL.
5- Save the custom block.
6- Save the layout builder.

Proposed resolution

I suggest adding a custom validation on the link dialog form to validate the URL before saving the link.

Remaining tasks

Patch

🐛 Bug report
Status

RTBC

Component

Code

Created by

🇯🇴Jordan Odai Atieh Amman

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

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.71.5 2024