Problem
We have this line in our code:
https://github.com/Lullabot/ph_tools/blob/main/src/PageService.php#L81
// @todo: turn this into a hook!
$entity_parameter = $route_match->getParameter($entity_type_id) ?? $route_match->getParameter('current_entity');
$entity_preview_parameter = $route_match->getParameter($entity_type_id . '_preview');
if ($entity_parameter) {
$entity = $entity_parameter;
}
if ($entity_preview_parameter) {
$entity = $entity_preview_parameter;
}
Note the 'current_entity' custom parameter. This comes from the Bravo project and it should be made generic.
Proposed solution
Let's introduce a hook that can be used by sites to derive the entity parameter.
$entity_parameter = $route_match->getParameter($entity_type_id);
$this->moduleHandler->hookAlter($entity_parameter);