diff --git a/paragraphs.module b/paragraphs.module index a37a264..190e470 100644 --- a/paragraphs.module +++ b/paragraphs.module @@ -83,7 +83,11 @@ function paragraphs_form_entity_form_display_edit_form_alter(&$form, \Drupal\Cor foreach ($field_definitions as $key => $value) { if ($field_definitions[$key]->getType() == 'entity_reference_revisions') { if ($field_definitions[$key]->getSettings()['target_type'] == 'paragraph') { + // Loop over the display options of an err field with paragraph target + // type. foreach ($form['fields'][$key]['plugin']['type']['#options'] as $option => $value) { + // Unset the widget display options that are no longer supported for + // the Paragraphs field. if (in_array($option, ['options_buttons', 'options_select', 'entity_reference_revisions_autocomplete'])) { unset($form['fields'][$key]['plugin']['type']['#options'][$option]); } @@ -98,12 +102,9 @@ function paragraphs_form_entity_form_display_edit_form_alter(&$form, \Drupal\Cor */ function paragraphs_form_field_storage_config_edit_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if ($form_state->getFormObject()->getEntity()->getType() == 'entity_reference') { - foreach ($form['settings']['target_type']['#options']['Content'] as $key => $value) { - if ($key == 'paragraph') { - // Entity Reference fields are no longer supported by Paragraphs. - unset($form['settings']['target_type']['#options']['Content'][$key]); - } - } + // Entity Reference fields are no longer supported for referencing + // Paragraphs. + unset($form['settings']['target_type']['#options'][(string) t('Content')]['paragraph']); } }