Modules display ID validation does not work with Paragraphs anymore

Created on 20 August 2024, 5 months ago
Updated 18 September 2024, 4 months ago

Problem/Motivation

The new display id validation does not work when the viewsreference field is in a paragraph. When saving the node the browser does the validation. When using the 'novalidate' attribute on the node form, the form can be saved without being validated.
This wasn't a problem before when ViewsreferenceItem::isEmpty() was validating it.

In the latest version (2.0-beta9) the module checks for $field_values[0]['target_id'] and $field_values[0]['display_id'] which do not exisits when using a paragraph.
With paragraphs it's $field_values[0]['subform'][FIELDNAME][0]['target_id'] and $field_values[0]['subform'][FIELDNAME][0]['display_id'].
It would be great if paragraphs would be supported again.

I'm using Drupal 10.3.2 and Viewsreference 2.0-beta9.

Steps to reproduce

1. Install the Paragraphs module and the Views Reference Field Module
2. Create a paragraph with a viewsreference field
3. Add the paragraph to a content type like 'basic page'
4. Create a new content, fill out/select a view, leave display empty
(5. Add 'novalidate' attribute to form element, to see that it will save without validation when the browser does not validate it)
6. Save

๐Ÿ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany lmoeni

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024