The base idea is to be able to run custom code that injects additional variables in the view template.
For instance, it would be possible to attach a service to any override rule. This service would implement an interface that allows to:
1. inject custom variables in the view
2. change the etag of the response so that the cache takes care of the custom logic for the view.
Currently, in Content or Location views, you only have access to the Location and the associated Content. In most cases, that's not enough to generate any non trivial view.
To workaround, those issues you have 4 options:
1. write a twig extensions with functions/filters that fetch some missing data, that's more or less the revival of our eZ 3/4 fetch functions, to me it's a bad practice and this should be avoided. And this would also cause cache issues.
2. Exposes services in the template, that's more or less the same as the previous point.
3. use the PreContentViewEvent, unfortunately, those events are global (ie triggered for every views) and it's not very easy/clean to figure out in which case you are. In addition, that's not really cache friendly.
4. use a sub-request. This is probably the cleanest way for now, but this has some performances impacts, that's not that easy to do and for some use cases, this feels wrong.
References forum posts:
Let the developer use his own custom controller to handle Content/Location objects.