The module's admin index and settings form should live under /admin. This patch also moves the entity paths under /admin, since it seems to make sense to put those there (the entities aren't exposed directly to the end user), but we could keep those as they are, not 100% sure what's best.

CommentFileSizeAuthor
#2 3016219_2_move_admin_routes.patch4.06 KBbrunodbo

Comments

brunodbo created an issue. See original summary.

brunodbo’s picture

Status: Active » Needs review
StatusFileSize
new4.06 KB
shaundychko’s picture

Status: Needs review » Needs work

Following the lead of Drupal Commerce, entities that aren't seen by users, such as Payment, have routes without the /admin prefix. See the route provider for Payment https://cgit.drupalcode.org/commerce/tree/modules/payment/src/Entity/Pay... for example.

brunodbo’s picture

For the routes without admin prefix, should we follow the template of /{entity_type}/add, /{entity_type}/edit, ...? For the admin ones (collections), we could use the plural of the entity type id? So for billing plans, this would become something like:

 *   links = {
 *     "canonical" = "/billing_plan/{billing_plan}",
 *     "add-form" = "/billing_plan/add",
 *     "edit-form" = "/billing_plan/{billing_plan}/edit",
 *     "delete-form" = "/billing_plan/{billing_plan}/delete",
 *     "collection" = "/admin/braintree-cashier/billing-plans",
 *   },
shaundychko’s picture

What does Drupal Commerce do? We should do the same.

brunodbo’s picture

- For routes to publicly visible entities, Commerce follows the pattern /{entity_type_id}/{entity}, e.g., /product/{commerce_product} (https://cgit.drupalcode.org/commerce/tree/modules/product/src/Entity/Pro...)
- For routes to non-publicly visible entities, Commerce follows the pattern /admin/commerce/{entity_type_id_shorthand_plural}/{entity}, e.g., /admin/commerce/orders/{commerce_order} (https://cgit.drupalcode.org/commerce/tree/modules/order/src/Entity/Order...)

So in our case:

 *   links = {
 *     "canonical" = "/admin/braintree-cashier/billing-plans/{billing_plan}",
 *     "add-form" = "/admin/braintree-cashier/billing-plans/add",
 *     "edit-form" = "/admin/braintree-cashier/billing-plans/{billing_plan}/edit",
 *     "delete-form" = "/admin/braintree-cashier/billing-plans/{billing_plan}/delete",
 *     "collection" = "/admin/braintree-cashier/billing-plans",
 *   },

  • ShaunDychko committed 32f721b on 8.x-2.x authored by brunodbo
    Issue #3016219 by brunodbo, ShaunDychko: Move admin routes under /admin
    
shaundychko’s picture

Status: Needs work » Fixed

Thanks for checking into that. I also update paths for the Views in config/install and added an update hook to rebuild the routes. Thanks for the patch.

brunodbo’s picture

Thanks! I was going to update the collection routes in the patch, so they would be /admin/braintree-cashier/billing-plans, /admin/braintree-cashier/discounts, etc.

Does that sounds good? If so, do you prefer a reroll here, or a follow up issue?

shaundychko’s picture

Sure, that sounds fine, thanks. Let's please open a new issue if you don't mind.

brunodbo’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.