If there is no nodes in current taxonomy term to display, load vocabulary and display other difficult to formulate a question

I have made a View, which display title, image, body(trimmed) on nodes pages with Content type - Home, its related nodes to this one(. Home has different categories - taxonomy, for example looks like this:


Homes one
homes two  
homes three


So for example if my current node has taxonomy term - homes two i should display only nodes(title, image, body(trimmed) of this term. I did it like this - with contextual filters Content: Nid - i exclude current node to not display it in my view and 

Content: Has taxonomy term ID


When filter is not available - i provide my own value, php code:

 $node = node_load(arg(1));
 if($node) {
 foreach($node-&gt;field_home_category[LANGUAGE_NONE] as $term) { 
    $terms[] = $term['tid']; 
 }
    return implode('+',$terms);
  } 
  else { 
    return
  }


$node-&gt;field_home_category[LANGUAGE_NONE] -  is a field which contains taxonomy term id.

And its works fine, but if my node is only single in homes two taxonomy term, the view returns nothing(for obvious reasons) and if this happens i need to display any other Home nodes.

I think i should load my taxonomy vocabulary and get all the terms and pass them to my view in this situation. Like this:

$tree = taxonomy_get_tree(2); // vocabulary id - is 2
    foreach ($tree as $term) {
        $options[] = $term-&gt;tid;
      }
      return implode('+', $options);


but i dont know how to add this to my view.

Something like this ->

PSEUDO CODE:

IF THERE IS NO NODES IN CURRENT TERM
   DO 
      LOAD VOCABULARY OF HOMES
    AND 
      DISPLAY ANY AVALIABLE NODES OF THIS VOCABULARY


//////////////////////////////////////////////////////

I will post full solution, maybe helps someone:

//////////////////////////////////////////////////////

No results behavior is great, but there is few situations:

For example: 

homes two contains 2 homes, one is excluded, so view will display only 1 home, but we need 3 homes to be displayed all the time.


What i did is created new view, which displays 3 homes randomly(global Random sort criteria)
and excluded nid in contextual filter, i allow to pass multiple values to nid.
and in THEME_views_pre_render(&amp;$view) i did next thing:

function THEME_views_pre_render(&amp;$view) {
  if ($view-&gt;name == 'home') { // check is this my view
      $args = $view-&gt;args; //passed arguments
      $results = &amp;$view-&gt;result; // this is important , you should pass it by reference
      if (!empty($args) &amp;&amp; isset($args[0]) &amp;&amp; isset($args[1])) {
        $node = node_load($args[1]);
        if ($node-&gt;type == 'home') { // check node type
            foreach($view-&gt;result as $row) {
                $restricted[] = $row-&gt;nid; //push current nodes to array, to pass them later to our new view, to not display them
            }
            $result_count = count($view-&gt;result);
            switch ($result_count) {
                case 1: // if one home
                    //gett the results of my view which display all nodes
                    // and do not display node which already displayed
                    // aka $restricted array
                    $result_array = views_get_view_result('related_homes_and_features', 'block_3', $restricted);
                    //add this results to current view
                    //
                    array_push($results, $result_array[0],$result_array[1]);
                    break;
                case 2:
                    $result_array = views_get_view_result('related_homes_and_features', 'block_3', $restricted);
                    array_push($results, $result_array[0]);
                    break;
                case 3:
                    $result_array = views_get_view_result('related_homes_and_features', 'block_3');
                    array_push($results, $result_array[0], $result_array[1], $result_array[2]);
                    return;
                    break;
            }
        }
    }
  }
}


home that helps someone.
Use "No results behavior" of the view ; specify a new view ("Global: View area"), showing all nodes, excluding the taxonomy term "homes two".