- Issue created by @socalerich
- πΊπΈUnited States socalerich
I'm not sure if there is a better way to do this, but what ended up working for us was to add a preprocess function to our .theme file like this:
function YOUR_THEME_preprocess_views_exposed_form(&$variables) { if(isset($variables['form']['#view']) && $variables['form']['#view']->total_rows) { $variables['total_rows'] = $variables['form']['#view']->total_rows; } }
- Status changed to Closed: outdated
7 months ago 8:14pm 10 April 2024 - πΊπΈUnited States smustgrave
Thanks for reporting, I think your solution should be just fine.
- π¬π§United Kingdom gsquirrel London
I tried that solution but it did not work for me - and there was no "#view" visible in kint under $vars['form']
- πΊπΈUnited States socalerich
Did you remember to replace "YOUR_THEME" with the actual name of your theme in the function declaration?
- π¬π§United Kingdom gsquirrel London
Yes it is using my theme name, and the function itself is working but no data comes through to "total_rows" - as I say if I add kint to inspect the available variables (into the preprocess function) then I can see $vars['form'] expanded with all the available data - but no sign of "view" or anything remotely similar - only the exposed form data itself..
My form is for a search_api index view - maybe this makes a difference?