From 8ef736be4604845446e5a30c142350ba6bb25e1e Mon Sep 17 00:00:00 2001 From: Gordon Heydon Date: Mon, 10 Apr 2017 11:46:37 +1000 Subject: [PATCH] Issue #2868155 by gordon: Add new hooks to allow easier editing of paragraph forms --- src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php | 2 ++ src/Plugin/Field/FieldWidget/ParagraphsWidget.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php b/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php index 35aac3f..b56f143 100644 --- a/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php +++ b/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php @@ -652,6 +652,8 @@ class InlineParagraphsWidget extends WidgetBase { } } } + + \Drupal::ModuleHandler()->alter([ 'paragraphs_component_form', 'paragraphs_component_' . $paragraphs_entity->get('type')[0]->target_id . '_form' ], $element['subform'], $form_state, $delta); } elseif ($item_mode == 'preview') { $element['subform'] = array(); diff --git a/src/Plugin/Field/FieldWidget/ParagraphsWidget.php b/src/Plugin/Field/FieldWidget/ParagraphsWidget.php index 52041b4..afdf0f4 100644 --- a/src/Plugin/Field/FieldWidget/ParagraphsWidget.php +++ b/src/Plugin/Field/FieldWidget/ParagraphsWidget.php @@ -622,6 +622,8 @@ class ParagraphsWidget extends WidgetBase { } } } + + \Drupal::ModuleHandler()->alter([ 'paragraphs_component_form', 'paragraphs_component_' . $paragraphs_entity->get('type')[0]->target_id . '_form' ], $element['subform'], $form_state, $delta); } elseif ($item_mode == 'preview') { $element['subform'] = array(); -- 2.11.0 (Apple Git-81)