- Issue created by @kenorb
- Status changed to Fixed
almost 2 years ago 12:44am 13 May 2023 - πΊπΈUnited States tr Cascadia
"Webform is viewed" is a specific version of "Entity is viewed", which is triggered by the core Drupal
hook_entity_view()
.See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21... for an explanation of the entity lifecycle in Drupal.
The critical thing to understand with this hook/event is that it is only triggered when the entity is rendered for display. When the entity is loaded from the cache (which it almost ALWAYS is ...), it DOESN'T get rendered again so
hook_entity_view()
hook will not be called and the "Webform is viewed" event will not be generated. This is fundamental to how Drupal core and Drupal caching works.If what you want to do is have a Rule triggered whenever a specific page is visited, then "Webform is viewed" is not the correct event to use for this reason, AND because an entity like a Webform can appear not only on its own page (
/node/12
for example) but can also appear on many other pages (plain/node
for example) so viewing the entity is NOT a guarantee that you're on the page you think you're on.Instead, use the "Drupal is initializing" event, which is triggered on every page load, then use a path comparison condition such as "Path contains text" or "Path text comparison" to determine if you're on the correct page before executing your action.
Automatically closed - issue fixed for 2 weeks with no activity.