Problem/Motivation

The website encountered an unexpected error. Try again later.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.content_type.canonical" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 242 of core/lib/Drupal/Core/Routing/RouteProvider.php).

Steps to reproduce

Current D11 and content_entity_builder
Install module and try to add a base entity

Proposed resolution

I have looked at the code and in my opinion something is missing in the
content_entity_builder.routing.yml

adding this a the end of the file and a drush cr solved the problem.

entity.content_type.canonical:
path: '/admin/structure/content-types/manage/{content_type}'
defaults:
_controller: '\Drupal\content_entity_builder\Controller\ContentEntityBuilderController::editContentType'
_title_callback: '\Drupal\content_entity_builder\Controller\ContentEntityBuilderController::editContentTypeTitle'
requirements:
_permission: 'administer content entity types'
options:
parameters:
content_type:
type: entity:content_type

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bennos created an issue. See original summary.

bennos’s picture

Little change. better use:

entity.content_type.canonical:
  path: '/admin/structure/content-types/manage/{content_type}'
  defaults:
    _controller: '\Drupal\content_entity_builder\Controller\ContentEntityBuilderController::editContentType'
    _title_callback: '\Drupal\content_entity_builder\Controller\ContentEntityBuilderController::editContentTypeTitle'
  requirements:
    _permission: 'administer content entity types'

looks like the problem is not fully solved. after adding a new entity and after adding the first field in the new entity thiss appears:
The website encountered an unexpected error. Try again later.

InvalidArgumentException: The controller for URI "" is not callable. in Drupal\Core\Controller\ControllerResolver->getControllerFromDefinition() (line 38 of core/lib/Drupal/Core/Controller/ControllerResolver.php).

after as drush cr it all fine and cleared. look like there is a something like

\Drupal::service('router.builder')->rebuild();

needed. Better we find the right place for this together.

dkmishra made their first commit to this issue’s fork.

dkmishra’s picture

Please review.

vinodhini.e’s picture

Hi,

  • Reproduced the issue on Drupal 11.4.2.
  • Creating a new base entity triggered the Route "entity.content_type.canonical" does not exist error.
  • Applied MR #4 and retested.
  • Verified that the base entity can now be created and accessed successfully.
  • The routing error is no longer occurring, and its working as expected.

Thanks.

  • 6e50037c committed on 2.1.x
    Issue #3615960: Add the missing entity.content_type.canonical route,...
nagy.balint’s picture

Status: Needs review » Fixed

Thanks

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.