Drupal ParamConverter Example Module

Project GitHub Stars
1
Project GitHub Watchers
1

This is an example module that shows how to create a custom ParamConverter service in Drupal. This is useful if you want to translate parameters into entities without having to load them in the controller.

The module consists of a custom content entity called ContentEntityExample. This entity contains a slug that can be used to translate the parameter in the URL into an entity.

A hook_install() hook is used to generate an example entity so that you can see the module in action straight away. Just visit /content_entity_example/test-content-entity after installing the module to see this in action.

This module is compatible with Drupal version 9 and 10.

Feel free to adapt this example to your needs.