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

Drupal example source code file (poll.views.inc)

This example Drupal source code file (poll.views.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, field, function, handler, nid, node, php, return, sort, sortable, title, true, type, yes-no

The poll.views.inc Drupal example source code

<?php
// $Id: poll.views.inc,v 1.4.6.1 2009/11/02 22:01:26 merlinofchaos Exp $
/**
 * @file
 * Provide views data and handlers for poll.module
 */

/**
 * @defgroup views_poll_module poll.module handlers
 *
 * Includes only the core 'poll' table for now.
 * @{
 */

/**
 * Implements hook_views_data()
 */
function poll_views_data() {
  // Basic table information.
  $data['poll']['table']['group']  = t('Poll');

  // Join to 'node' as a base table.
  $data['poll']['table']['join'] = array(
    'node' => array(
      'left_field' => 'nid',
      'field' => 'nid',
    ),
  );

  // ----------------------------------------------------------------
  // Fields

  // poll active status
  $data['poll']['active'] = array(
    'title' => t('Active'),
    'help' => t('Whether the poll is open for voting.'),
    'field' => array(
      'handler' => 'views_handler_field_boolean',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_boolean_operator',
      'label' => t('Active'),
      'type' => 'yes-no',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  return $data;
}

/**
 * @}
 */

Other Drupal examples (source code examples)

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

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.