ref_field.install in (Entity)Reference Field Synchronization 7
Install, update and uninstall functions for the reference field module.
File
ref_field.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the reference field module.
*/
/**
* Implements hook_field_schema().
*/
function ref_field_field_schema($field) {
switch ($field['type']) {
case 'ref_field':
$columns = array(
'eid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
);
$indexes = array(
'eid' => array(
'eid',
),
);
$foreign = array();
// TODO: Is this legal?
if (isset($field['base table'])) {
$foreign = array(
'eid' => array(
'table' => $field['base table'],
'columns' => array(
'eid' => $field['entity keys']['id'],
),
),
);
}
break;
}
return array(
'columns' => $columns,
'indexes' => $indexes,
'foreign keys' => $foreign,
);
}
/**
* Implements hook_enable().
*/
function ref_field_enable() {
// When enabling with modules that need this field
// make sure Drupal knows about it
// It won't be in cache during enabling process otherwise
field_cache_clear();
}
Functions
Name | Description |
---|---|
ref_field_enable | Implements hook_enable(). |
ref_field_field_schema | Implements hook_field_schema(). |