[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/data/ -> data.api.php (source)

   1  <?php
   2  
   3  /**
   4   * @file
   5   * Documentation of hooks.
   6   */
   7  
   8  /**
   9   * Invoked after a data record has been inserted.
  10   */
  11  function hook_data_insert($record, $table_name) {
  12  }
  13  
  14  /**
  15   * Invoked after a data record has been updated.
  16   */
  17  function hook_data_update($record, $table_name) {
  18  }
  19  
  20  /**
  21   * Invoked before a delete. Add to/remove from a delete query before deleting.
  22   */
  23  function hook_data_delete_query_alter(&$query, $table_name) {
  24  }
  25  
  26  /**
  27   * Expose default tables.
  28   *
  29   * Note:
  30   *
  31   * - Implementor is responsible for creating this table on installation and for
  32   *   proper updates in case of schema changes (hook_install(), hook_update_N())
  33   * - Implement hook_ctools_plugin_api() to make this hook discoverable by
  34   *   CTools - see below.
  35   */
  36  function hook_data_default() {
  37    $export = array();
  38    $data_table = new stdClass;
  39    $data_table->disabled = FALSE; /* Edit this to true to make a default data_table disabled initially */
  40    $data_table->api_version = 1;
  41    $data_table->title = 'Example';
  42    $data_table->name = 'data_table_example';
  43    $data_table->table_schema = array(
  44      'fields' => array(
  45        'id' => array(
  46          'type' => 'int',
  47          'size' => 'normal',
  48          'unsigned' => TRUE,
  49        ),
  50      ),
  51      'primary key' => array(
  52        '0' => 'id',
  53      ),
  54    );
  55    $data_table->meta = array(
  56      'fields' => array(
  57        'id' => array(
  58          'label' => 'Identifier',
  59        ),
  60      ),
  61    );
  62  
  63    $export['data_table_example'] = $data_table;
  64    return $export;
  65  }
  66  
  67  /**
  68   * Example for a CTools Plugin API implementation for hook_data_default().
  69   */
  70  function hook_ctools_plugin_api() {
  71    $args = func_get_args();
  72    $module = array_shift($args);
  73    $api = array_shift($args);
  74    if ($module == "data" && $api == "data_default") {
  75      return array("version" => 1);
  76    }
  77  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7