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 @@ -670,10 +670,10 @@ $subform_state = SubformState::createForSubform($element['behavior_plugins'][$plugin_id], $form, $form_state); if ($plugin_form = $plugin->buildBehaviorForm($paragraphs_entity, $element['behavior_plugins'][$plugin_id], $subform_state)) { $element['behavior_plugins'][$plugin_id] = $plugin_form; + // Add the paragraphs-behavior class, so that we are able to show + // and hide behavior fields, depending on the active perspective. + $element['behavior_plugins'][$plugin_id]['#attributes']['class'][] = 'paragraphs-behavior'; } - // Add the paragraphs-behavior class, so that we are able to show - // and hide behavior fields, depending on the active perspective. - $element['behavior_plugins'][$plugin_id]['#attributes']['class'][] = 'paragraphs-behavior'; } } }