Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

Entity parameter fallbacks for "current entity for page" as a hook #1

@e0ipso

Description

@e0ipso

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions