function tripal_example_node_info

2.x tripal_example.chado_node.inc tripal_example_node_info()

Implementation of hook_node_info().

This hook provides information to Drupal about any node types that are being created by this module. If your module does not create any node types then this function is not required.

File

tripal_example/includes/tripal_example.chado_node.inc, line 18
This file should contain all Drupal hooks for interacting with nodes.

Code

function tripal_example_node_info() {
  $nodes = array();

  // EXPLANATION: this array describes all of the node types that are created
  // by this module. For many Tripal modules (e.g. tripal_example, tripal_stock,
  // tripal_library, tripal_pub, etc.) new node types are created. It is
  // customary to name all new node types that interact with data in Chado
  // with a 'chado_' prefix.

  $nodes['chado_example'] = array(
    'name' => t('Example'),
    'base' => 'chado_example',
    'description' => t('A record from the fake chado example table'),
    'has_title' => TRUE,
    'locked' => TRUE,
    // EXPLANATION: This section of the node type array specifies how Tripal
    // will sync the node types with data in Chado. When Drupal creates a node
    // it has no way of coordinating which node belongs to which record in
    // Chado. Therefore, Tripal maintains tables in the Drupal schema that maps
    // Drupal nodes to records in Chado. Syncing is the process of creating
    // Drupal nodes and linking them to the appropriate record.
    'chado_node_api' => array(
      // the base table name (e.g. example, example, contact)
      'base_table' => 'example',
      // the node type hook prefix
      'hook_prefix' => 'chado_example',
      'record_type_title' => array(
        // how to refer to the record
        'singular' => t('Example'),
        // how to refer to the record in plurals
        'plural' => t('Examples')
      ),
      'sync_filters' => array(
        'type_id' => TRUE, // if the record has a type_id set to TRUE
        'organism_id' => TRUE // if the record has an organism_id set to TRUE
      ),
    )
  );

  return $nodes;
}