Quantcast
Viewing all articles
Browse latest Browse all 295016

Auto generate routing entries for entities based on an 'admin_path' and 'admin_permission' annotation

Updated: Comment #0

Problem/Motivation

Most config entities follow a common pattern.

  • A list page.
  • An edit page and tab.
  • A delete page and form.
  • An add page.
  • An optional enable/disable page/callback (when there is a status entity key defined).
  • Most of these point to entity forms and list controllers anyway ie there are no true controllers, and the enable/disable can be generalized for most use cases.

As a proof of concept, this patch demonstrates its functionality by removing contact.routing.yml which (at this stage) only points to the routes above.

Note that if you want to change the path (ie keep routing separate from paths) you can still hook_entity_info_alter(), change the 'admin_path' and it will keep working. Note this patch generates route ids of the form {module}.{entity_type}_list|add|edit|delete etc.

Proposed resolution

Dynamically generate the routes for a better DX.

Remaining tasks

Review

User interface changes

None

API changes

A new 'admin_path' and 'admin_permission' annotation entry added for config entities.


Viewing all articles
Browse latest Browse all 295016

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>