You are here

function views_ifempty_handler_field::render in Views If Empty 6

Same name and namespace in other branches
  1. 7 includes/views/handlers/views_ifempty_handler_field.inc \views_ifempty_handler_field::render()

Render the output.

File

handlers/views_ifempty_handler_field.inc, line 111
Views field handler to output an alterate field when a field is empty.

Class

views_ifempty_handler_field
@file Views field handler to output an alterate field when a field is empty.

Code

function render($values) {
  $emptyfield = $this->options['emptyfield'];
  $outputfield = $this->options['outputfield'];
  if (!empty($emptyfield) && !empty($outputfield) && $emptyfield != $outputfield) {
    $fields = $this->view->display_handler
      ->get_handlers('field');
    if (isset($fields[$emptyfield]) && isset($fields[$outputfield])) {
      if (empty($fields[$emptyfield]->last_render)) {
        $this->last_render = $fields[$outputfield]->last_render;
      }
      else {
        $this->last_render = $fields[$emptyfield]->last_render;
      }
    }
  }
  return $this->last_render;
}