Question

Does this function views_get_current_view inside views header or footer (to count rows number for example) means running the same view twice?
Or is it somewhat simplified version of running full view? Thank you.

Was it helpful?

Solution

That function is just a wrapper for this function: https://api.drupal.org/api/views/views.module/function/views_set_current_view/7.x-3.x which will just return a reference to a static code cache.

Conclusion: no view gets run, it's just grabbing a copy of what's already been created.

In general, views is very efficient in such cases.

But I'd tend to agree with @berramou that you might have a better way of accomplishing what you really, really want.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top