setHandler into views_pre_render OR count results in views_pre_render I have a view that needs to have a custom views footer only if it get results. Otherwise the view needs to not be displayed

I can set up a view footer by using $view-&gt;setHandler with hook_views_pre_render and I can count results with hook_views_pre_render

How can I achieve both with a single function? Using $view-&gt;setHandler with hook_views_pre_render does not attach the footer
Found an alternative solution, by using hook_views_pre_render and $view-&gt;attachment_after

$view-&gt;attachment_after = array('#markup' =&gt; '&lt;a href="/" title="Title" class="button"&gt;Button&lt;/a&gt;');