- Issue created by @das-peter
- Merge request !15#Issue 3505553:Fix missing rootParent handling in ParagraphEditForm::save() → (Open) created by Unnamed author
- 🇮🇳India kulpratap2002
I’ve addressed the TypeError in ParagraphEditForm::save() by adding a check for $this->rootParent before calling shouldCreateNewRevision().
Since the missing rootParent seems to be caused by a bug in the All Entity Preview module, I opted for a middle-ground approach:
If rootParent is missing, a warning is logged to help with debugging.
The form still triggers a save—defaulting to creating a new revision— to prevent potential data loss.
I didn’t use a hard error (like throwing an exception) to avoid breaking content workflows. Let me know if you'd prefer stricter error handling or further adjustments! - 🇮🇳India debrup
The changes look good to me. Installed the module and did some manual testing. Working as expected with no errors.
@bbrala Please check the recent changes and merge.
- 🇮🇳India abhishek@kumar
Strict Parameter Enforcement
// In ParagraphEditForm.php public function buildForm(array $form, FormStateInterface $form_state, ?EntityInterface $root_parent = NULL) { if (!$root_parent) { throw new \InvalidArgumentException('The root parent entity must be provided.'); } // Rest of the method }