Skip to content

Commit

Permalink
Fix alert banner entity type paths and local tasks
Browse files Browse the repository at this point in the history
Fix #342

Use the standard drupal paths (entity_type/manage) for the alert banner
entity type routes, and add a local task for the edit link.
This restores expected behaviour with edit, fields, manage form,
manage display,  permissions.

Remove unneed entity type route provider and remove todo comment
from entity type list builder.
  • Loading branch information
andybroomfield committed Jun 30, 2024
1 parent 7bc68a0 commit 6e19819
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 34 deletions.
5 changes: 5 additions & 0 deletions localgov_alert_banner.links.task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ entity.localgov_alert_banner.collection:
base_route: system.admin_content
title: 'Alert banners'
weight: 30

entity.localgov_alert_banner_type.edit_form:
title: Edit
route_name: entity.localgov_alert_banner_type.edit_form
base_route: entity.localgov_alert_banner_type.edit_form
26 changes: 0 additions & 26 deletions src/AlertBannerEntityTypeHtmlRouteProvider.php

This file was deleted.

1 change: 0 additions & 1 deletion src/AlertBannerEntityTypeListBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function buildHeader() {
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity->label();
$row['id'] = $entity->id();
// You probably want a few more properties here...
return $row + parent::buildRow($entity);
}

Expand Down
13 changes: 6 additions & 7 deletions src/Entity/AlertBannerEntityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* "delete" = "Drupal\localgov_alert_banner\Form\AlertBannerEntityTypeDeleteForm"
* },
* "route_provider" = {
* "html" = "Drupal\localgov_alert_banner\AlertBannerEntityTypeHtmlRouteProvider",
* "html" = "Drupal\Core\Entity\Routing\AdminHtmlRouteProvider",
* "permissions" = "Drupal\user\Entity\EntityPermissionsRouteProvider",
* },
* },
Expand All @@ -42,12 +42,11 @@
* "label"
* },
* links = {
* "canonical" = "/admin/structure/alert-banner-types/{localgov_alert_banner_type}",
* "add-form" = "/admin/structure/alert-banner-types/add",
* "edit-form" = "/admin/structure/alert-banner-types/{localgov_alert_banner_type}/edit",
* "delete-form" = "/admin/structure/alert-banner-types/{localgov_alert_banner_type}/delete",
* "entity-permissions-form" = "/admin/structure/alert-banner-types/{localgov_alert_banner_type}/permissions",
* "collection" = "/admin/structure/alert-banner-types"
* "add-form" = "/admin/structure/localgov_alert_banner_types/add",
* "edit-form" = "/admin/structure/localgov_alert_banner_types/manage/{localgov_alert_banner_type}",
* "delete-form" = "/admin/structure/localgov_alert_banner_types/manage/{localgov_alert_banner_type}/delete",
* "entity-permissions-form" = "/admin/structure/localgov_alert_banner_types/manage/{localgov_alert_banner_type}/permissions",
* "collection" = "/admin/structure/localgov_alert_banner_types"
* }
* )
*/
Expand Down

0 comments on commit 6e19819

Please sign in to comment.