You are here

class library_handler_field_quantity in Library 6

Same name and namespace in other branches
  1. 6.2 includes/views/handlers/library_handler_field_quantity.inc \library_handler_field_quantity
  2. 7 includes/views/handlers/library_handler_field_quantity.inc \library_handler_field_quantity

Display the library quantity

Hierarchy

Expanded class hierarchy of library_handler_field_quantity

1 string reference to 'library_handler_field_quantity'
library_views_data in includes/views/library.views.inc
Implementation of hook_views_data()

File

includes/views/handlers/library_handler_field_quantity.inc, line 6

View source
class library_handler_field_quantity extends views_handler_field {
  function construct() {
    parent::construct();
    $this->additional_fields['nid'] = 'nid';
  }
  function query() {
    $this
      ->ensure_my_table();
    $this
      ->add_additional_fields();
  }
  function render($values) {
    $nid = $values->{$this->aliases['nid']};
    $node = node_load($nid);
    if (isset($node->items) && !empty($node->items)) {
      return count($node->items);
    }
    return '';
  }

}

Members