For the context_uuid_condition, the current entity is loaded via menu_get_object() in order to check if the entity is the one specified for the condition.

This is a clean approach, but with limitations. For instance, I've got a site with a page View that overrides the path for taxonomy terms, which means that menu_get_object() doesn't return an entity.

In order to circumvent this, we need to load the current menu item based on the path, and information about the entity type. This will provide us with enough information to check if the path is displaying the entity in question, and if the UUID matches.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

olofbokedal’s picture

Tested with a taxonomy term which works as intended. Probably needs some more testing for other entities.

skwashd’s picture

In your example use case you are no longer viewing an entity, you are viewing a view. Looking at this code it adds a fair bit of processing overhead on every page load to check if someone is trying to access a view that overrides an entity list page. I would suggest that you create a new module that extends the context_uuid_condition class with your own implementation of execute().

skwashd’s picture

Status: Active » Needs work