Kontainer remove button fails in paragraphs with cardinality > 1

Created on 23 January 2024, 10 months ago

Problem/Motivation

The remove button for the Kontainer reference item removes all values in the paragraph field after Drupal 10.2, because the $delta argument in the formElement function is no longer incremented within the paragraph field.

Steps to reproduce

  • Install the paragraphs module
  • Create a paragraph type with the Kontainer media reference field
  • Add a field referencing the created paragraph type to a node and set its cardinality to unlimited
  • Add/edit the node with the paragraph field and add multiple Kontainer items within it
  • Click the (Kontainer) remove button (next to the Kontainer select button) on any of the Kontainer items within the paragraph field
  • All of the entries within the paragraph field are removed

Proposed resolution

Either disable the remove button for paragraph reference fields (because
the remove button from paragraphs can be used) and add a hint message to the field widget with an explanation or add subform
deltas from $form['#parents'] to data-kontainer-selector
attributes in the Kontainer reference item widget.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇸🇮Slovenia slogar32

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

Comments & Activities

Production build 0.71.5 2024