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.
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.
-
-
Yes, you don't want to be putting code in the header/footer. But you might instead be able to accomplish what you want without custom code - most things I ever want to do with views have already been done and documented if you look hard enough. – Alan Dixon Nov 15 '19 at 18:06
@count
that you can use in the header. If its something else other than counting usetemplate_preprocess_views_view
orhook_views_pre_render
and do your logic there. – No Sssweat Nov 15 '19 at 18:14