• Objective: Bring Views "Node Example" docs into 3.0
  • Summary: I have recently used the Views API docs "Node Example" to add non-Drupal data tables and fields to be fully usable by the Views UI. A few slight changes needed to be made in order to run in 3.0 (or perhaps the tutorial just assumed knowledge of the ".info" file). Regardless, two slight changes will bring this up to date and they are as follows. I would be glad to make any updates in some other place if someone would point me in the right direction.
  • Original: http://views-help.doc.logrus.com/help/views/api-example
  • PostgreSQL Compatibility: I added a version of the table definition that follows POstgreSQL syntax.

node_example.info file

name = Node Example Module
description = This contains example on creating custom fields for Views.
core = 7.x
php = 5.2.4
dependencies[] = ctools
dependencies[] = views

node_example.module file

<?php
/**
 * Implementation of hook_views_api().
 *
 * This tells drupal that there is Views integration file named
 * module-name.views.inc
 */
function node_example_views_api() {
  // Note that you can include 'path' in this array so that your views.inc
  // file can be stored in a different location.
  return array(
    'api' => 3.0
  );
}
?>

Comments

robertwb’s picture

Issue summary: View changes