Created
May 19, 2019 01:02
-
-
Save andybroomfield/9a9ae83df8f3f012b6d59cc4becfffd9 to your computer and use it in GitHub Desktop.
Patch for Drupal Paragrams with field group horizontal tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php b/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php | |
index ce8d108..2d9bda9 100644 | |
--- a/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php | |
+++ b/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php | |
@@ -643,7 +643,7 @@ class InlineParagraphsWidget extends WidgetBase { | |
]; | |
field_group_attach_groups($element['subform'], $context); | |
- $element['subform']['#pre_render'][] = 'field_group_form_pre_render'; | |
+ $element['subform']['#process'][] = 'field_group_form_process'; | |
} | |
if ($item_mode == 'edit') { | |
@@ -1320,8 +1320,9 @@ class InlineParagraphsWidget extends WidgetBase { | |
$item['target_revision_id'] = $paragraphs_entity->getRevisionId(); | |
} | |
// If our mode is remove don't save or reference this entity. | |
+ // The check to see if mode is present is due to field group tabs. | |
// @todo: Maybe we should actually delete it here? | |
- elseif($widget_state['paragraphs'][$item['_original_delta']]['mode'] == 'remove' || $widget_state['paragraphs'][$item['_original_delta']]['mode'] == 'removed') { | |
+ elseif(isset($widget_state['paragraphs'][$item['_original_delta']]['mode']) && ($widget_state['paragraphs'][$item['_original_delta']]['mode'] == 'remove' || $widget_state['paragraphs'][$item['_original_delta']]['mode'] == 'removed')) { | |
$item['target_id'] = NULL; | |
$item['target_revision_id'] = NULL; | |
} | |
diff --git a/src/Plugin/Field/FieldWidget/ParagraphsWidget.php b/src/Plugin/Field/FieldWidget/ParagraphsWidget.php | |
index edb24b9..a508a2e 100644 | |
--- a/src/Plugin/Field/FieldWidget/ParagraphsWidget.php | |
+++ b/src/Plugin/Field/FieldWidget/ParagraphsWidget.php | |
@@ -758,7 +758,7 @@ class ParagraphsWidget extends WidgetBase { | |
]; | |
field_group_attach_groups($element['subform'], $context); | |
- $element['subform']['#pre_render'][] = 'field_group_form_pre_render'; | |
+ $element['subform']['#process'][] = 'field_group_form_process'; | |
} | |
if ($item_mode == 'edit') { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See Drupal issue https://www.drupal.org/project/paragraphs/issues/2907094
Here so I can test.