- 🇩🇪Germany snitch182 Hannover
Hello,
This still happens in Drupal 9. Any recommendations ? So far one can work "around" this with saving the whole page once you openend a h5p part. Once you unfold another part the h5p is "emptied". - 🇫🇮Finland jhuhta
I just wanted to point out that there's a similar issue with a patch: 🐛 Paragraphs module compatibility Needs review . Maybe one of these could be closed as duplicate?
The data is not lost only when opening/closing paragraphs, but also when adding/deleting unrelated paragraph types from the entity.
- 🇺🇸United States partdigital
I also ran into this issue when expanding/collapsing paragraphs:
- Drupal Core: 10.1.6
- Paragraphs: 1.16
- H5P: 2.0.x
It seems to be caused by the submitted form values not being properly formatted upon Expand/Collapse. A quick fix for this was to simply remove some code in
H5PWidgetBase::massageFormValues
.public function massageFormValues(array $values, array $form, FormStateInterface $form_state) { // Remove this condition. if (!$form_state->isValidationComplete()) { return $values; } // ... Code removed for brevity ... // The condition is preventing this method from running which properly formats the code. $return_values[$delta] = $this->massageFormValue($value['h5p_content'], $delta, $do_new_revision); } return $return_values; }
I've attached a patch for this however since it's removing some code there is the possibility of introducing a regression. It could definitely use some extra review/testing.