Parasolx

Professional in Drupal web development, theme designing, consultation and training

Check embedded Views return empty or not

21 Dec 2015 - 12:39 pm

Views providing alternative to embed into any template using hook of views_embed_view(). However, it produce still produce a bunch of division HTML tag although the return result is zero or empty. To make sure there should be no rendering for empty Views by using this snippet:

$view = views_get_view_result($name, $display, $args);
$result = count($view);
if ($result) {
//do something here
}

 

Kategori: 
Tags: 
views
empty return result