Score:0

Last item missing for multiple fields when editing a node

de flag

I'm using a multiple paragraphs field on a node.

I noticed that each time I saved the node and then edited it again, the last item (delta n-1 with delta starting at 0) would disappear. If I clicked on the Add new button, it would repopulate with the content of the missing field. However, if I saved without taking any further action, the next last field would disappear.

I dug around in the module code, and fixed the issue with the following code in the InlineParagraphsWidget.php file (line 879 onward).

$elements += [
  '#element_validate' => [[$this, 'multipleElementValidate']],
  '#required' => $this->fieldDefinition->isRequired(),
  '#field_name' => $field_name,
  '#cardinality' => $cardinality,
  '#max_delta' => $max, // Was $max - 1
];

I find it hard to believe nobody else has encountered this bug with a module as popular as Paragraphs. Is it because it's running on Drupal 9, or maybe it's specific to the site installation?

miststudent2011 avatar
fr flag
I would suggest to get it reported in module issue queue as well.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.