diff --git a/core/modules/field_ui/src/FieldConfigListBuilder.php b/core/modules/field_ui/src/FieldConfigListBuilder.php index ed8d9f4..32a63f7 100644 --- a/core/modules/field_ui/src/FieldConfigListBuilder.php +++ b/core/modules/field_ui/src/FieldConfigListBuilder.php @@ -168,14 +168,14 @@ public function getDefaultOperations(EntityInterface $entity) { $operations['edit'] = array( 'title' => $this->t('Edit'), 'weight' => 10, - 'url' => $entity->urlInfo("{$entity->getTargetEntityTypeId()}-field-edit-form"), + 'url' => $entity->urlInfo("{$entity->getTargetEntityTypeId()}-field-edit-form", ['language' => NULL]), ); } if ($entity->access('delete') && $entity->hasLinkTemplate("{$entity->getTargetEntityTypeId()}-field-delete-form")) { $operations['delete'] = array( 'title' => $this->t('Delete'), 'weight' => 100, - 'url' => $entity->urlInfo("{$entity->getTargetEntityTypeId()}-field-delete-form"), + 'url' => $entity->urlInfo("{$entity->getTargetEntityTypeId()}-field-delete-form", ['language' => NULL]), ); } @@ -183,7 +183,7 @@ public function getDefaultOperations(EntityInterface $entity) { 'title' => $this->t('Storage settings'), 'weight' => 20, 'attributes' => array('title' => $this->t('Edit storage settings.')), - 'url' => $entity->urlInfo("{$entity->getTargetEntityTypeId()}-storage-edit-form"), + 'url' => $entity->urlInfo("{$entity->getTargetEntityTypeId()}-storage-edit-form", ['language' => NULL]), ); $operations['edit']['attributes']['title'] = $this->t('Edit field settings.'); $operations['delete']['attributes']['title'] = $this->t('Delete field.'); diff --git a/core/modules/image/src/ImageStyleListBuilder.php b/core/modules/image/src/ImageStyleListBuilder.php index b0ad227..fe0199e 100644 --- a/core/modules/image/src/ImageStyleListBuilder.php +++ b/core/modules/image/src/ImageStyleListBuilder.php @@ -78,7 +78,7 @@ public function getDefaultOperations(EntityInterface $entity) { $flush = array( 'title' => t('Flush'), 'weight' => 200, - 'url' => $entity->urlInfo('flush-form'), + 'url' => $entity->urlInfo('flush-form', ['language' => NULL]), ); return parent::getDefaultOperations($entity) + array( diff --git a/core/modules/responsive_image/src/ResponsiveImageStyleListBuilder.php b/core/modules/responsive_image/src/ResponsiveImageStyleListBuilder.php index 744edc3..77b1626 100644 --- a/core/modules/responsive_image/src/ResponsiveImageStyleListBuilder.php +++ b/core/modules/responsive_image/src/ResponsiveImageStyleListBuilder.php @@ -41,7 +41,7 @@ public function getDefaultOperations(EntityInterface $entity) { $operations['duplicate'] = array( 'title' => t('Duplicate'), 'weight' => 15, - 'url' => $entity->urlInfo('duplicate-form'), + 'url' => $entity->urlInfo('duplicate-form', ['language' => NULL]), ); return $operations; } diff --git a/core/modules/search/src/SearchPageListBuilder.php b/core/modules/search/src/SearchPageListBuilder.php index 55e3f97..489a952 100644 --- a/core/modules/search/src/SearchPageListBuilder.php +++ b/core/modules/search/src/SearchPageListBuilder.php @@ -315,6 +315,7 @@ public function getDefaultOperations(EntityInterface $entity) { 'title' => $this->t('Set as default'), 'url' => Url::fromRoute('entity.search_page.set_default', [ 'search_page' => $entity->id(), + 'language' => NULL, ]), 'weight' => 50, ); diff --git a/core/modules/shortcut/src/ShortcutSetListBuilder.php b/core/modules/shortcut/src/ShortcutSetListBuilder.php index 9de658d..41be0c0 100644 --- a/core/modules/shortcut/src/ShortcutSetListBuilder.php +++ b/core/modules/shortcut/src/ShortcutSetListBuilder.php @@ -37,7 +37,7 @@ public function getDefaultOperations(EntityInterface $entity) { $operations['list'] = array( 'title' => t('List links'), - 'url' => $entity->urlInfo('customize-form'), + 'url' => $entity->urlInfo('customize-form', ['language' => NULL]), ); return $operations; } diff --git a/core/modules/taxonomy/src/VocabularyListBuilder.php b/core/modules/taxonomy/src/VocabularyListBuilder.php index fe196c9..ee3b94c 100644 --- a/core/modules/taxonomy/src/VocabularyListBuilder.php +++ b/core/modules/taxonomy/src/VocabularyListBuilder.php @@ -44,12 +44,12 @@ public function getDefaultOperations(EntityInterface $entity) { $operations['list'] = array( 'title' => t('List terms'), 'weight' => 0, - 'url' => $entity->urlInfo('overview-form'), + 'url' => $entity->urlInfo('overview-form', ['language' => NULL]), ); $operations['add'] = array( 'title' => t('Add terms'), 'weight' => 10, - 'url' => Url::fromRoute('entity.taxonomy_term.add_form', ['taxonomy_vocabulary' => $entity->id()]), + 'url' => Url::fromRoute('entity.taxonomy_term.add_form', ['taxonomy_vocabulary' => $entity->id(), 'language' => NULL]), ); unset($operations['delete']); diff --git a/core/modules/user/src/RoleListBuilder.php b/core/modules/user/src/RoleListBuilder.php index 4e0dd73..4e5e636 100644 --- a/core/modules/user/src/RoleListBuilder.php +++ b/core/modules/user/src/RoleListBuilder.php @@ -51,7 +51,7 @@ public function getDefaultOperations(EntityInterface $entity) { $operations['permissions'] = array( 'title' => t('Edit permissions'), 'weight' => 20, - 'url' => $entity->urlInfo('edit-permissions-form'), + 'url' => $entity->urlInfo('edit-permissions-form', ['language' => NULL]), ); } return $operations; diff --git a/core/modules/views/src/Plugin/views/field/EntityOperations.php b/core/modules/views/src/Plugin/views/field/EntityOperations.php index 35fbfc3..5c39285 100644 --- a/core/modules/views/src/Plugin/views/field/EntityOperations.php +++ b/core/modules/views/src/Plugin/views/field/EntityOperations.php @@ -9,7 +9,9 @@ use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Routing\RedirectDestinationTrait; +use Drupal\views\Entity\Render\EntityTranslationRenderTrait; use Drupal\views\ResultRow; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -23,6 +25,7 @@ class EntityOperations extends FieldPluginBase { use RedirectDestinationTrait; + use EntityTranslationRenderTrait; /** * The entity manager. @@ -32,6 +35,13 @@ class EntityOperations extends FieldPluginBase { protected $entityManager; /** + * The language manager. + * + * @var \Drupal\Core\Language\LanguageManagerInterface + */ + protected $languageManager; + + /** * Constructor. * * @param array $configuration @@ -42,10 +52,14 @@ class EntityOperations extends FieldPluginBase { * The plugin implementation definition. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. + * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager + * The language manager. */ - public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityManagerInterface $entity_manager) { + public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition); + $this->entityManager = $entity_manager; + $this->languageManager = $language_manager; } /** @@ -56,13 +70,42 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager') + $container->get('entity.manager'), + $container->get('language_manager') ); } /** * {@inheritdoc} */ + public function getEntityTypeId() { + return $this->getEntityType(); + } + + /** + * {@inheritdoc} + */ + protected function getEntityManager() { + return $this->entityManager; + } + + /** + * {@inheritdoc} + */ + protected function getLanguageManager() { + return $this->languageManager; + } + + /** + * {@inheritdoc} + */ + protected function getView() { + return $this->view; + } + + /** + * {@inheritdoc} + */ public function usesGroupBy() { return FALSE; } @@ -98,7 +141,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { * {@inheritdoc} */ public function render(ResultRow $values) { - $entity = $this->getEntity($values); + $entity = $this->getEntityTranslation($this->getEntity($values), $values); + drupal_set_message('boo'); $operations = $this->entityManager->getListBuilder($entity->getEntityTypeId())->getOperations($entity); if ($this->options['destination']) { foreach ($operations as &$operation) { diff --git a/core/modules/views_ui/src/ViewListBuilder.php b/core/modules/views_ui/src/ViewListBuilder.php index cc11d8e..f5edd26 100644 --- a/core/modules/views_ui/src/ViewListBuilder.php +++ b/core/modules/views_ui/src/ViewListBuilder.php @@ -149,14 +149,14 @@ public function getDefaultOperations(EntityInterface $entity) { $operations['duplicate'] = array( 'title' => $this->t('Duplicate'), 'weight' => 15, - 'url' => $entity->urlInfo('duplicate-form'), + 'url' => $entity->urlInfo('duplicate-form', ['language' => NULL]), ); } // Add AJAX functionality to enable/disable operations. foreach (array('enable', 'disable') as $op) { if (isset($operations[$op])) { - $operations[$op]['url'] = $entity->urlInfo($op); + $operations[$op]['url'] = $entity->urlInfo($op, ['language' => NULL]); // Enable and disable operations should use AJAX. $operations[$op]['attributes']['class'][] = 'use-ajax'; }