- Status changed to Needs work
almost 2 years ago 7:57pm 20 January 2023 - Status changed to Needs review
almost 2 years ago 3:51pm 23 January 2023 - 🇺🇸United States smustgrave
Added an else statement to use a different label is $entity->label is empty.
The last submitted patch, 34: 2852898-34.patch, failed testing. View results →
- Status changed to Needs work
almost 2 years ago 8:11am 14 February 2023 - 🇫🇷France duaelfr Montpellier, France
+++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php @@ -130,17 +130,37 @@ public function getOperations(EntityInterface $entity) { + $label = $this->t('Edit') . ' ' . $entity->label(); ... + $label = $this->t('Edit') . ' ' . $entity->bundle() . ' ' . $this->t('ID') . ' ' . $entity->id(); ... + $label = $this->t('Delete') . ' ' . $entity->label(); ... + $label = $this->t('Delete') . ' ' . $entity->bundle() . ' ' . $this->t('ID') . ' ' . $entity->id();
From a translation perspective, these are looking quite bad. Using concatenation prevents some languages to provide an accurate translation because not all language has the words in the same order.
I'd suggest to use string placeholders, for example: "Edit @entity_bundle ID @entity_id"
- Status changed to Needs review
almost 2 years ago 8:22pm 21 February 2023 The last submitted patch, 38: 2852898-38.patch, failed testing. View results →
- Status changed to Needs work
over 1 year ago 12:56pm 22 April 2023 - 🇧🇪Belgium borisson_ Mechelen, 🇧🇪
+++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php @@ -57,11 +57,17 @@ public function testList() { + $edit_url->setOption('attributes', ['aria-label' => 'Edit ' . $entity->label()]); ... + $delete_url->setOption('attributes', ['aria-label' => 'Delete ' . $entity->label()]); @@ -132,16 +138,22 @@ public function testList() { + $edit_url->setOption('attributes', ['aria-label' => 'Edit ' . $entity->label()]); ... + $delete_url->setOption('attributes', ['aria-label' => 'Delete ' . $entity->label()]); +++ b/core/modules/user/tests/src/Functional/UserAdminTest.php @@ -75,7 +75,10 @@ public function testUserAdmin() { + 'attributes' => ['aria-label' => 'Edit ' . $user_a->label()],
Should be translated here as well?
- last update
over 1 year ago Custom Commands Failed - Status changed to Needs review
over 1 year ago 5:29pm 23 April 2023 - 🇺🇸United States smustgrave
@borisson_ I don't think they need to be as they are tests that aren't checking translations.
- Status changed to RTBC
over 1 year ago 5:40pm 23 April 2023 - last update
over 1 year ago 29,302 pass - last update
over 1 year ago 29,300 pass - last update
over 1 year ago 29,361 pass - last update
over 1 year ago 29,366 pass - last update
over 1 year ago 29,366 pass, 2 fail The last submitted patch, 40: 2852898-40.patch, failed testing. View results →
- last update
over 1 year ago 29,367 pass - last update
over 1 year ago 29,374 pass - last update
over 1 year ago 29,379 pass - Status changed to Needs work
over 1 year ago 12:16am 6 May 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Looking good, needs work/review for the question about bundle labels vs machine names
-
+++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php @@ -130,17 +130,37 @@ public function getOperations(EntityInterface $entity) { + if (!is_null($edit_url)) { + if (!empty($entity->label())) { + $label = $this->t('Edit @entity_label', ['@entity_label' => $entity->label()]);
Is this something we should be doing in Entity::toUrl?
Otherwise this would need to be piecemeal in quite a few places
-
+++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php @@ -130,17 +130,37 @@ public function getOperations(EntityInterface $entity) { + $label = $this->t('Edit @entity_bundle @entity_id', ['@entity_bundle' => $entity->bundle(), '@entity_id' => $entity->id()]);
This uses the bundle machine name - are we sure we want to do that - should we instead be fetching the bundle label?
-
+++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php @@ -132,16 +138,22 @@ public function testList() { // Test getOperations() method. + $edit_url = $entity->toUrl()->setOption('query', $this->getRedirectDestination()->getAsArray()); + $edit_url->setOption('attributes', ['aria-label' => 'Edit ' . $entity->label()]); + + $delete_url = $entity->toUrl('delete-form')->setOption('query', $this->getRedirectDestination()->getAsArray()); + $delete_url->setOption('attributes', ['aria-label' => 'Delete ' . $entity->label()]); +
We don't seem to have test coverage for the two else cases (when the edit url is null, and when the entity label is empty)
-
- Merge request !4211Issue #2852898: 508 Compliance Issue -Edit links on content page are not unique → (Closed) created by smustgrave
- Open on Drupal.org →Environment: PHP 8.2 & MySQL 8last update
over 1 year ago Waiting for branch to pass - last update
over 1 year ago 29,496 pass, 4 fail - 🇺🇸United States smustgrave
Response to #46
1. Not sure I follow what you mean?
2. Can't use the label in that scenario the label doesn't exist.
3. Added a test for checking when label is empty.Going to test if one of the if statements is truely needed.
- last update
over 1 year ago 29,498 pass, 2 fail - last update
over 1 year ago 29,499 pass - 🇺🇸United States smustgrave
So the is_null check was needed to setOption.
But not sure we need a test. $this->ensureDestination($entity->toUrl('delete-form') was part of the render array. I just moved it out to a variable so we can setOption on it.
- Status changed to Needs review
over 1 year ago 9:04pm 19 June 2023 - Status changed to Needs work
over 1 year ago 12:56am 18 July 2023 38:32 37:12 Running- Status changed to Needs review
over 1 year ago 1:30am 21 July 2023 - last update
over 1 year ago 29,827 pass - Status changed to Needs work
over 1 year ago 9:42am 24 July 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Sorry to be a pain, but I don't think we need to handle when the Urls are null, ::ensureDestination requires a Url object and calls a fluent setter on the object (thus always returning a Url)
- last update
about 1 year ago 30,396 pass, 2 fail - Status changed to Postponed
about 1 year ago 6:47pm 14 October 2023 - 🇺🇸United States smustgrave
Removing the null check opened 🐛 toUrl returns Null Active
- Status changed to Active
about 1 year ago 12:32am 16 October 2023 - last update
about 1 year ago 30,410 pass - Status changed to Needs review
about 1 year ago 12:45am 16 October 2023 - Status changed to RTBC
about 1 year ago 8:30am 17 October 2023 - 🇺🇸United States mherchel Gainesville, FL, US
- Looks like issues have been addressed.
- Tests exist and pass.
- Code looks good to me.
- Seems to work great
- Properly escapes data
- Status changed to Needs work
about 1 year ago 9:15am 17 October 2023 - Status changed to Needs review
about 1 year ago 10:45pm 18 October 2023 - 🇵🇪Peru marvil07
Back to NR, the last requested change may not be needed, per https://www.drupal.org/project/drupal/issues/2852898#mr4211-note219576 🐛 508 Compliance Issue -Edit links on content page are not unique Needs review
- Status changed to RTBC
about 1 year ago 9:14am 20 October 2023 - 🇬🇧United Kingdom FlusteredLondon
Based on the comments above from @marvil07, moving to RTC as not necessary.
@lauriii - are you happy with this?
- last update
about 1 year ago 30,420 pass - last update
about 1 year ago 30,426 pass - last update
about 1 year ago 30,434 pass - last update
about 1 year ago 30,438 pass - last update
about 1 year ago 30,456 pass - last update
about 1 year ago 30,472 pass - last update
about 1 year ago 30,483 pass - last update
about 1 year ago 30,486 pass - last update
about 1 year ago 30,486 pass - last update
about 1 year ago 30,488 pass - last update
about 1 year ago 30,512 pass - last update
about 1 year ago 30,519 pass - last update
about 1 year ago 30,530 pass - last update
about 1 year ago 30,552 pass - last update
about 1 year ago 30,602 pass - last update
about 1 year ago 30,603 pass - last update
about 1 year ago 30,605 pass - last update
about 1 year ago Build Successful 43:27 41:15 Running- last update
12 months ago 30,679 pass - last update
12 months ago 30,684 pass - last update
12 months ago 30,688 pass - last update
12 months ago 30,688 pass - last update
12 months ago 30,688 pass - last update
12 months ago 30,696 pass - last update
12 months ago 30,698 pass - last update
12 months ago 30,712 pass - last update
12 months ago 30,724 pass - last update
12 months ago 30,762 pass, 1 fail - last update
12 months ago 30,766 pass - last update
11 months ago 25,889 pass, 1,805 fail -
larowlan →
committed 6ee5f78c on 11.x
Issue #2852898 by smustgrave, _utsavsharma, mherchel, larowlan, bnjmnm,...
-
larowlan →
committed 6ee5f78c on 11.x
- Status changed to Fixed
11 months ago 2:52am 22 December 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Committed to 11.x
Didn't backport to 10.2.x because there are string changes here
Automatically closed - issue fixed for 2 weeks with no activity.