content_entity_routes
Content Entity Routes adds extra local-task tabs — like
/node/{node}/content or /media/{media}/preview —
to any fieldable content entity. Each tab renders the entity with a configured
view mode (read) or form mode (edit), fully
configurable through the admin UI. No custom code per entity type.
Why
Out of the box, a node has View, Edit and Delete
tabs. Many sites need a focused secondary editing surface — e.g. a
“Content” tab that only exposes paragraph fields, or a
“Preview” tab that renders a media item in a custom view mode.
Building that manually means a custom route, a custom local task, a custom
form-handler registration and a per-bundle opt-in mechanism — for every
entity type.
This module replaces all of that with one config entity:
Entity type Bundles Mode Slug Title Mode namenode
page, article
form
content
Content
content
taxonomy_term
categories
form
content
Content
content
media
image, icon
view
custom_preview
Live Preview
live_preview
Features
- Works with any entity type that is fieldable and has a canonical link template (node, taxonomy_term, media, user, commerce_product, …).
- View-mode tabs render the entity in any view mode you have configured.
- Form-mode tabs reuse the entity’s default form handler but pick up the matching form display automatically — the same trick
form_mode_manageruses, with no per-entity-type wiring. - Bundle filtering per tab (or leave empty to apply to all bundles).
- Translation-aware: form-mode tabs on translatable entities also expose
/{entity}/translations/edit/{language}/{slug}automatically, so editors can open the configured form mode against a specific non-current translation when navigating from the "Translations" overview. - Access delegated to the underlying entity’s
view/updatepermission, so existing entity access, workflows and content moderation keep working. - Fully exportable as configuration — tabs live in
config/synclike any other config entity. - Zero hard-coded entity types or paths.
How it works
- A config entity (
entity_route_tab) stores each tab definition. - A route subscriber appends
/{slug}to the entity’s canonical path. Form-mode tabs use Drupal’s built-in_entity_formroute default; view-mode tabs use a small controller that calls the view builder. hook_entity_type_alter()registers the entity type’s default form handler under the form-mode operation, soContentEntityFormpicks up the matching form display automatically.- A local task deriver attaches each tab to the canonical route. Bundle filtering is enforced by a
_custom_accesscheck, so tabs are auto-hidden on the wrong bundles viaurl.accesscacheability.
Usage
- Create a view mode or form mode you want to expose at Structure → Display modes.
- Enable that mode for the target bundle in Manage form display (form mode) or Manage display (view mode) and arrange the fields.
- Go to Structure → Entity route tabs and add a new tab. Pick the entity type, bundles, mode type, mode name, slug, title and weight.
- The new tab appears on the matching entity pages and is reachable at
<canonical-path>/<slug>, e.g./node/42/content.
Permissions
- Administer entity route tabs — manage the config entities.
- Per-tab access is delegated to the entity’s
view(view-mode tab) orupdate(form-mode tab) check, so no extra permissions to wire up.
Requirements
- Drupal 10.3+ or Drupal 11
- PHP 8.1+
- An existing view mode or form mode on the target entity type
Installation
composer require drupal/content_entity_routes drush en content_entity_routes
Roadmap
- Add-translation in form mode — equivalent of
/{entity}/translations/add/{source}/{target}/{slug}, so a brand-new translation can be created directly in a custom form mode (today only the edit-translation variant is wired up). - Local task derivation on the translations overview page, so the form-mode tabs appear there too instead of requiring direct URL access.
Similar modules
- Form mode manager — exposes extra form modes as routes. Content Entity Routes covers both form and view modes, with explicit per-tab config entities (label, slug, bundle filter, weight) instead of an automatic per-form-mode route. It also ships an edit-translation route variant that form_mode_manager doesn’t.
- View mode page — nodes only. Content Entity Routes works for any fieldable entity type and exposes both view and form modes.