diff -u b/js/paragraphs.js b/js/paragraphs.js --- b/js/paragraphs.js +++ b/js/paragraphs.js @@ -16,7 +16,7 @@ } else { $('.paragraphs-content').hide(); - $('.paragraphs-nested.paragraphs-subform').show(); + $('.paragraphs-nested.paragraphs-subform > .paragraphs-content').show(); $('.paragraphs-behavior').show(); } }, diff -u b/src/Plugin/Field/FieldWidget/ParagraphsWidget.php b/src/Plugin/Field/FieldWidget/ParagraphsWidget.php --- b/src/Plugin/Field/FieldWidget/ParagraphsWidget.php +++ b/src/Plugin/Field/FieldWidget/ParagraphsWidget.php @@ -1189,7 +1189,7 @@ // Validate all enabled behavior plugins. $paragraphs_type = $entity->getParagraphType(); foreach ($paragraphs_type->getEnabledBehaviorPlugins() as $plugin_id => $plugin_values) { - $plugin_values->validateBehaviorForm($element['behavior_plugins'][$plugin_id], $form_state); + $plugin_values->validateBehaviorForm($element['subform'][$plugin_id], $form_state); } } } @@ -1245,14 +1245,14 @@ $paragraphs_entity->set($langcode_key, $form_state->get('langcode')); } } - if (isset($item['behavior_plugins'])) { + if (isset($item['subform'])) { // Submit all enabled behavior plugins. $paragraphs_type = $paragraphs_entity->getParagraphType(); foreach ($paragraphs_type->getEnabledBehaviorPlugins() as $plugin_id => $plugin_values) { - if (!isset($item['behavior_plugins'][$plugin_id])) { - $item['behavior_plugins'][$plugin_id] = []; + if (!isset($item['subform'][$plugin_id])) { + $item['subform'][$plugin_id] = []; } - $plugin_values->submitBehaviorForm($paragraphs_entity, $item['behavior_plugins'][$plugin_id]); + $plugin_values->submitBehaviorForm($paragraphs_entity, $item['subform'][$plugin_id]); } } only in patch2: unchanged: --- a/src/Tests/Experimental/ParagraphsExperimentalBehaviorsTest.php +++ b/src/Tests/Experimental/ParagraphsExperimentalBehaviorsTest.php @@ -68,13 +68,13 @@ class ParagraphsExperimentalBehaviorsTest extends ParagraphsExperimentalTestBase // Create a node with a Paragraph. $this->drupalGet('node/add/paragraphed_test'); - $this->assertFieldByName('field_paragraphs[0][behavior_plugins][test_text_color][text_color]', 'green'); + $this->assertFieldByName('field_paragraphs[0][subform][test_text_color][text_color]', 'green'); // Setting a not allowed value in the text color plugin text field. $plugin_text = 'green'; $edit = [ 'title[0][value]' => 'paragraphs_plugins_test', 'field_paragraphs[0][subform][field_text][0][value]' => 'amazing_plugin_test', - 'field_paragraphs[0][behavior_plugins][test_text_color][text_color]' => $plugin_text, + 'field_paragraphs[0][subform][test_text_color][text_color]' => $plugin_text, ]; $this->drupalPostForm(NULL, $edit, t('Save and publish')); // Asserting that the error message is shown. @@ -82,7 +82,7 @@ class ParagraphsExperimentalBehaviorsTest extends ParagraphsExperimentalTestBase // Updating the text color to an allowed value. $plugin_text = 'red'; $edit = [ - 'field_paragraphs[0][behavior_plugins][test_text_color][text_color]' => $plugin_text, + 'field_paragraphs[0][subform][test_text_color][text_color]' => $plugin_text, ]; $this->drupalPostForm(NULL, $edit, t('Save and publish')); // Assert that the class has been added to the element. @@ -90,21 +90,21 @@ class ParagraphsExperimentalBehaviorsTest extends ParagraphsExperimentalTestBase $this->clickLink('Edit'); // Assert the plugin fields populate the stored values. - $this->assertFieldByName('field_paragraphs[0][behavior_plugins][test_text_color][text_color]', $plugin_text); + $this->assertFieldByName('field_paragraphs[0][subform][test_text_color][text_color]', $plugin_text); // Update the value of both plugins. $updated_text = 'blue'; $edit = [ - 'field_paragraphs[0][behavior_plugins][test_text_color][text_color]' => $updated_text, - 'field_paragraphs[0][behavior_plugins][test_bold_text][bold_text]' => TRUE, + 'field_paragraphs[0][subform][test_text_color][text_color]' => $updated_text, + 'field_paragraphs[0][subform][test_bold_text][bold_text]' => TRUE, ]; $this->drupalPostForm(NULL, $edit, t('Save and keep published')); $this->assertNoRaw('class="red_plugin_text'); $this->assertRaw('class="blue_plugin_text bold_plugin_text'); $this->clickLink('Edit'); // Assert the plugin fields populate the stored values. - $this->assertFieldByName('field_paragraphs[0][behavior_plugins][test_text_color][text_color]', $updated_text); - $this->assertFieldByName('field_paragraphs[0][behavior_plugins][test_bold_text][bold_text]', TRUE); + $this->assertFieldByName('field_paragraphs[0][subform][test_text_color][text_color]', $updated_text); + $this->assertFieldByName('field_paragraphs[0][subform][test_bold_text][bold_text]', TRUE); // Test plugin applicability. Add a paragraph type. $paragraph_type = 'text_paragraph_test';