You are here

function library_handler_field_quantity::render in Library 7

Same name and namespace in other branches
  1. 6.2 includes/views/handlers/library_handler_field_quantity.inc \library_handler_field_quantity::render()
  2. 6 includes/views/handlers/library_handler_field_quantity.inc \library_handler_field_quantity::render()

Implements render().

Overrides views_handler_field::render

File

includes/views/handlers/library_handler_field_quantity.inc, line 32
Field handler for library item quantity

Class

library_handler_field_quantity
Display the library quantity

Code

function render($values) {
  $nid = $values->{$this->aliases['nid']};

  // @todo Optimize so noad_load is avoided.
  $node = node_load($nid);
  if (isset($node->library_items) && !empty($node->library_items)) {
    return count($node->library_items);
  }
  return '';
}