You are here

function hook_data_default in Data 8

Same name and namespace in other branches
  1. 6 data.api.php \hook_data_default()
  2. 7 data.api.php \hook_data_default()

Expose default tables.

Note:

  • Implementor is responsible for creating this table on installation and for proper updates in case of schema changes (hook_install(), hook_update_N())
  • Implement hook_ctools_plugin_api() to make this hook discoverable by CTools - see below.

File

./data.api.php, line 36
Documentation of hooks.

Code

function hook_data_default() {
  $export = array();
  $data_table = new stdClass();
  $data_table->disabled = FALSE;

  /* Edit this to true to make a default data_table disabled initially */
  $data_table->api_version = 1;
  $data_table->title = 'Example';
  $data_table->name = 'data_table_example';
  $data_table->table_schema = array(
    'fields' => array(
      'id' => array(
        'type' => 'int',
        'size' => 'normal',
        'unsigned' => TRUE,
      ),
    ),
    'primary key' => array(
      '0' => 'id',
    ),
  );
  $data_table->meta = array(
    'fields' => array(
      'id' => array(
        'label' => 'Identifier',
      ),
    ),
  );
  $export['data_table_example'] = $data_table;
  return $export;
}