You are here

function translation_overview_schema_add_submit in Translation Overview 6.2

Alter the schema when new languages are added.

1 string reference to 'translation_overview_schema_add_submit'
translation_overview_form_alter in ./translation_overview.module
Implementation of hook_form_alter().

File

./translation_overview.module, line 383

Code

function translation_overview_schema_add_submit($form, &$form_state) {
  $fieldname = translation_overview_field_name($form_state['values']['langcode']);
  if (!db_column_exists('translation_overview_priority', $fieldname)) {
    $ret = array();
    $field = array(
      'type' => 'int',
      'size' => 'tiny',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => TRANSLATION_OVERVIEW_NORMAL,
    );
    $keys = array(
      'indexes' => array(
        $fieldname => array(
          $fieldname,
        ),
      ),
    );
    db_add_field($ret, 'translation_overview_priority', $fieldname, $field, $keys);
    watchdog('translation_overview', 'Added a column for %langcode to the translation_overview_priority table.', array(
      '%langcode' => $form_state['values']['langcode'],
    ));
  }
}