<p>Probably depends on the specifics of what you're trying to accomplish, but your best bets I'm guessing would be to listen to some of the <a href="https://craftcms.com/docs/plugins/events-reference#element-api-events" rel="nofollow noreferrer">element level events</a>, make sure it's an entry and a site request, then do your logic.</p>

<p><a href="https://craftcms.com/docs/plugins/events-reference#elements-onBeforeBuildElementsQuery" rel="nofollow noreferrer">onBeforeBuildElementsQuery</a>, <a href="https://craftcms.com/docs/plugins/events-reference#elements-onBuildElementsQuery" rel="nofollow noreferrer">onBuildElementsQuery</a>, and <a href="https://craftcms.com/docs/plugins/events-reference#elements-onPopulateElements" rel="nofollow noreferrer">onPopulateElements</a> are potential candidates. </p>

CC BY-SA 3.0
2016-12-08T17:38:34.227Z
2016-12-08T17:38:34.227Z
Brad Bell
<p>Is there a hook in Craft to intercept an Entry before being returned to a (front-end) template? Thinking here of ways we can manipulate what is being returned in the Element Criteria Model without affecting the underlying content.</p>

<p>Thoughts appreciated</p>

<plugin-development><templating><elementcriteriamodel><hook>
Plugin Development: intercept Entry before returned to template
# Plugin Development: intercept Entry before returned to template

(Asked by: username_0 on 2016-12-08)

Is there a hook in Craft to intercept an Entry before being returned to a (front-end) template? Thinking here of ways we can manipulate what is being returned in the Element Criteria Model without affecting the underlying content.

Thoughts appreciated

**Tags:** plugin-development, templating, elementcriteriamodel, hook


---

## 1 answers

### Answer by username_1 on 2016-12-08. Score: 0 | Accepted answer

Probably depends on the specifics of what you're trying to accomplish, but your best bets I'm guessing would be to listen to some of the [element level events](https://craftcms.com/docs/plugins/events-reference#element-api-events), make sure it's an entry and a site request, then do your logic.

[onBeforeBuildElementsQuery](https://craftcms.com/docs/plugins/events-reference#elements-onBeforeBuildElementsQuery), [onBuildElementsQuery](https://craftcms.com/docs/plugins/events-reference#elements-onBuildElementsQuery), and [onPopulateElements](https://craftcms.com/docs/plugins/events-reference#elements-onPopulateElements) are potential candidates.


---

