diff --git a/src/Plugin/EntityQueueHandler/Simple.php b/src/Plugin/EntityQueueHandler/Simple.php index 58301a9..68e7d23 100644 --- a/src/Plugin/EntityQueueHandler/Simple.php +++ b/src/Plugin/EntityQueueHandler/Simple.php @@ -6,11 +6,11 @@ use Drupal\Core\Entity\EntityRepositoryInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\Core\Routing\RedirectDestinationTrait; use Drupal\entityqueue\Entity\EntitySubqueue; use Drupal\entityqueue\EntityQueueHandlerBase; use Drupal\entityqueue\EntityQueueInterface; use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Core\Language\LanguageManagerInterface; /** * Defines an entity queue handler that manages a single subqueue. @@ -23,8 +23,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; */ class Simple extends EntityQueueHandlerBase implements ContainerFactoryPluginInterface { - use RedirectDestinationTrait; - /** * The entity repository. * @@ -39,6 +37,14 @@ class Simple extends EntityQueueHandlerBase implements ContainerFactoryPluginInt */ protected $moduleHandler; + + /** + * Language manager service. + * + * @var \Drupal\Core\Language\LanguageManagerInterface + */ + protected $languageManager; + /** * Constructs a Simple queue handler object. * @@ -53,11 +59,12 @@ class Simple extends EntityQueueHandlerBase implements ContainerFactoryPluginInt * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityRepositoryInterface $entity_repository, ModuleHandlerInterface $module_handler) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityRepositoryInterface $entity_repository, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->entityRepository = $entity_repository; $this->moduleHandler = $module_handler; + $this->languageManager = $language_manager; } /** @@ -69,7 +76,8 @@ class Simple extends EntityQueueHandlerBase implements ContainerFactoryPluginInt $plugin_id, $plugin_definition, $container->get('entity.repository'), - $container->get('module_handler') + $container->get('module_handler'), + $container->get('language_manager') ); } @@ -98,7 +106,7 @@ class Simple extends EntityQueueHandlerBase implements ContainerFactoryPluginInt $operations['edit_subqueue'] = [ 'title' => $this->t('Edit items'), 'weight' => -9, - 'url' => $subqueue->toUrl('edit-form')->mergeOptions(['query' => $this->getRedirectDestination()->getAsArray()]), + 'url' => $subqueue->toUrl('edit-form', ['language' => $this->languageManager->getCurrentLanguage()]), ]; // Add a 'Translate' operation if translation is enabled for this queue.