You are here

function translation_overview_schema in Translation Overview 6.2

Implementation of hook_schema().

File

./translation_overview.install, line 23

Code

function translation_overview_schema() {
  $schema['translation_overview_priority'] = array(
    'description' => t('Track the priority in which nodes should be translated into various languages.'),
    'fields' => array(
      'tnid' => array(
        'description' => t('The identifier for a node or set of node translations.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'tnid',
    ),
  );

  // Load the module file so that we have access to TRANSLATION_OVERVIEW_NORMAL
  // and translation_overview_field_name().
  module_load_include('module', 'translation_overview');

  // And dynamically assemble the table with a column per languages. Call
  // language_list() with $reset = TRUE in case the languages have changed.
  foreach (language_list('language', TRUE) as $lang_code => $language) {
    $field = translation_overview_field_name($lang_code);
    $schema['translation_overview_priority']['fields'][$field] = array(
      'type' => 'int',
      'size' => 'tiny',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => TRANSLATION_OVERVIEW_NORMAL,
    );
    $schema['translation_overview_priority']['indexes'][$field] = array(
      $field,
    );
  }
  return $schema;
}