diff --git a/core/core.services.yml b/core/core.services.yml index bbef9fe..d341606 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -172,7 +172,7 @@ services: - { name: persist } entity.manager: class: Drupal\Core\Entity\EntityManager - arguments: ['@container.namespaces', '@service_container', '@module_handler', '@cache.cache', '@language_manager', '@string_translation', '@url_generator'] + arguments: ['@container.namespaces', '@service_container', '@module_handler', '@cache.cache', '@language_manager', '@string_translation'] plugin.manager.entity: alias: entity.manager plugin.manager.field.field_type: diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index cdcd667..3d19d73 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -18,7 +18,6 @@ use Drupal\Core\Plugin\Discovery\CacheDecorator; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; use Drupal\Core\Plugin\Discovery\InfoHookDecorator; -use Drupal\Core\Routing\UrlGeneratorInterface; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\Core\TypedData\TranslatableInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -107,13 +106,6 @@ class EntityManager extends PluginManagerBase implements EntityManagerInterface protected $translationManager; /** - * The url generator. - * - * @var \Drupal\Core\Routing\UrlGeneratorInterface - */ - protected $urlGenerator; - - /** * Static cache of bundle information. * * @var array @@ -136,11 +128,8 @@ class EntityManager extends PluginManagerBase implements EntityManagerInterface * The language manager. * @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager * The string translationManager. - * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator - * The url generator. - */ - public function __construct(\Traversable $namespaces, ContainerInterface $container, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManager $language_manager, TranslationInterface $translation_manager, UrlGeneratorInterface $url_generator) { + public function __construct(\Traversable $namespaces, ContainerInterface $container, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManager $language_manager, TranslationInterface $translation_manager) { // Allow the plugin definition to be altered by hook_entity_info_alter(). $this->moduleHandler = $module_handler; @@ -148,7 +137,6 @@ public function __construct(\Traversable $namespaces, ContainerInterface $contai $this->languageManager = $language_manager; $this->namespaces = $namespaces; $this->translationManager = $translation_manager; - $this->urlGenerator = $url_generator; $this->discovery = new AnnotatedClassDiscovery('Entity', $namespaces, 'Drupal\Core\Entity\Annotation\EntityType'); $this->discovery = new InfoHookDecorator($this->discovery, 'entity_info'); @@ -318,7 +306,7 @@ public function getAdminPath($entity_type, $bundle) { if (isset($entity_info['bundle_entity_type'])) { $route_parameters[$entity_info['bundle_entity_type']] = $bundle; } - $admin_path = $this->urlGenerator->getPathFromRoute($entity_info['links']['admin-form'], $route_parameters); + $admin_path = \Drupal::urlGenerator()->getPathFromRoute($entity_info['links']['admin-form'], $route_parameters); } return $admin_path; @@ -328,10 +316,11 @@ public function getAdminPath($entity_type, $bundle) { * {@inheritdoc} */ public function getAdminRouteInfo($entity_type, $bundle) { + $entity_info = $this->getDefinition($entity_type); return array( 'route_name' => "field_ui.overview_$entity_type", 'route_parameters' => array( - 'bundle' => $bundle, + $entity_info['bundle_entity_type'] => $bundle, ) ); } diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index 340ecad..036eeea 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -250,7 +250,7 @@ function field_ui_form_node_type_form_submit($form, &$form_state) { $form_state['redirect_route'] = array( 'route_name' => 'field_ui.overview_node', 'route_parameters' => array( - 'bundle' => $form_state['values']['type'], + 'node_type' => $form_state['values']['type'], ), ); } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldDeleteForm.php b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldDeleteForm.php index 7e37efb..edb6a7a 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldDeleteForm.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldDeleteForm.php @@ -79,10 +79,11 @@ public function submit(array $form, array &$form_state) { drupal_set_message($this->t('There was a problem removing the %field from the %type content type.', array('%field' => $this->entity->label(), '%type' => $bundle_label)), 'error'); } + $entity_info = $this->entityManager->getDefinition($this->entity->entity_type); $form_state['redirect_route'] = array( 'route_name' => 'field_ui.overview_' . $this->entity->entity_type, 'route_parameters' => array( - 'bundle' => $this->entity->bundle, + $entity_info['bundle_entity_type'] => $this->entity->bundle, ) ); diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php index 062dd40..354ff70 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php @@ -206,10 +206,11 @@ public function submitForm(array &$form, array &$form_state) { $form_state['redirect'] = $next_destination; } else { + $entity_info = $this->entityManager->getDefinition($this->instance->entity_type); $form_state['redirect_route'] = array( 'route_name' => 'field_ui.overview_' . $this->instance->entity_type, 'route_parameters' => array( - 'bundle' => $this->instance->bundle, + $entity_info['bundle_entity_type'] => $this->instance->bundle, ) ); } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php index 7b50745..a095d8c 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php @@ -193,10 +193,11 @@ public function submitForm(array &$form, array &$form_state) { $form_state['redirect'] = $next_destination; } else { + $entity_info = $this->entityManager->getDefinition($this->instance->entity_type); $form_state['redirect_route'] = array( 'route_name' => 'field_ui.overview_' . $this->instance->entity_type, 'route_parameters' => array( - 'bundle' => $this->instance->bundle, + $entity_info['bundle_entity_type'] => $this->instance->bundle, ) ); }