devdaily home | career | drupal | java | mac | mysql | perl | php | uml | unix

Drupal example source code file (image_gallery_handler_field_gallery_count.inc)

This example Drupal source code file (image_gallery_handler_field_gallery_count.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, class, count, extends, function, image, output, php, query, render, return, taxonomy_term_count_nodes, values, views_handler_field_taxonomy

The image_gallery_handler_field_gallery_count.inc Drupal example source code

<?php
// $Id: image_gallery_handler_field_gallery_count.inc,v 1.1.2.1 2010/08/03 17:43:00 sun Exp $

/**
 * Views handler for Image gallery count field. This counts all the nodes in
 * the gallery, including descendant galleries, using taxonomy.module's
 * taxonomy_term_count_nodes.
 */
class image_gallery_handler_field_gallery_count extends views_handler_field_taxonomy {

  /**
   * Override query() so we don't query: fake field.
   */
  function query() {
    $this->ensure_my_table();
    $this->add_additional_fields();
  }

  /**
   * Return field html.
   */
  function render($values) {
    $count = taxonomy_term_count_nodes($values->tid, 'image');
    $output = theme('image_gallery_count', $count);
    return $this->render_link($output, $values);
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal image_gallery_handler_field_gallery_count.inc source code file:

new blog posts


 


"Drupal" is a registered trademark of Dries Buytaert.

our drupal tutorials and examples  
 
Sponsored by:
Mat-Su Valley Programming (Wasilla and Palmer, Alaska)

Copyright 1998-2011 Alvin Alexander, devdaily.com
All Rights Reserved.