.../EntityReferenceEntityFormatter.php | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php index 221776b..555560a 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php @@ -134,10 +134,18 @@ public function settingsForm(array $form, FormStateInterface $form_state) { $bundle_entity_type_id = $this->entityTypeManager->getDefinition($entity_type_id)->getBundleEntityType(); $bundles = array_keys($this->getFieldSetting('handler_settings')['target_bundles']); if (count($bundles) === 1) { - $description = Link::fromTextAndUrl( - $this->t('Configure view modes'), - Url::fromRoute(sprintf('entity.entity_view_display.%s.default', $entity_type_id), [$bundle_entity_type_id => $bundles[0]]) - )->toRenderable(); + $description = [ + '#type' => 'link', + '#title' => $this->t('Configure view modes'), + '#url' => Url::fromRoute(sprintf('entity.entity_view_display.%s.default', $entity_type_id), [$bundle_entity_type_id => $bundles[0]]), + '#attributes' => [ + 'class' => ['use-ajax'], + 'data-dialog-type' => 'modal', + 'data-dialog-options' => json_encode([ + 'width' => 800, + ]), + ], + ]; } else { $bundle_info = entity_get_bundles($entity_type_id); @@ -147,10 +155,18 @@ public function settingsForm(array $form, FormStateInterface $form_state) { '#items' => [], ]; for ($i = 0; $i < count($bundles); $i++) { - $description['#items'][] = Link::fromTextAndUrl( - $this->t('Configure %bundle-label view modes', ['%bundle-label' => $bundle_info[$bundles[$i]]['label']]), - Url::fromRoute(sprintf('entity.entity_view_display.%s.default', $entity_type_id), [$bundle_entity_type_id => $bundles[$i]]) - )->toRenderable(); + $description['#items'][] = [ + '#type' => 'link', + '#title' => $this->t('Configure %bundle-label view modes', ['%bundle-label' => $bundle_info[$bundles[$i]]['label']]), + '#url' => Url::fromRoute(sprintf('entity.entity_view_display.%s.default', $entity_type_id), [$bundle_entity_type_id => $bundles[$i]]), + '#attributes' => [ + 'class' => ['use-ajax'], + 'data-dialog-type' => 'modal', + 'data-dialog-options' => json_encode([ + 'width' => 800, + ]), + ], + ]; } } $elements['view_mode'] = [