/[drupal]/contributions/modules/active_translation/active_translation.install
ViewVC logotype

Contents of /contributions/modules/active_translation/active_translation.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.9 - (show annotations) (download) (as text)
Fri Mar 27 19:23:51 2009 UTC (7 months, 4 weeks ago) by drewish
Branch: MAIN
CVS Tags: DRUPAL-6--1-4, DRUPAL-6--1-3, HEAD
Changes since 1.8: +2 -2 lines
File MIME type: text/x-php
#385612 by robertgarrigos: Wrong link to i18n settings on requirements error message
1 <?php
2 // $Id: active_translation.install,v 1.8 2008/11/17 08:42:56 drewish Exp $
3
4 /**
5 * Implementation of hook_install().
6 */
7 function active_translation_install() {
8 // The schema installation happens in active_translation_enable().
9 }
10
11 /**
12 * Implementation of hook_uninstall().
13 */
14 function active_translation_uninstall() {
15 variable_del('active_translation_show_status');
16 variable_del('active_translation_hide_node_links');
17 }
18
19 /**
20 * Implementation of hook_enable().
21 */
22 function active_translation_enable() {
23 drupal_install_schema('active_translation');
24
25 require_once drupal_get_path('module', 'active_translation') .'/active_translation.batch.inc';
26 batch_set(active_translation_build_batch_all());
27 }
28
29 /**
30 * Implementation of hook_disable().
31 */
32 function active_translation_disable() {
33 drupal_uninstall_schema('active_translation');
34 }
35
36 /**
37 * Implementation of hook_requirements().
38 */
39 function active_translation_requirements($phase) {
40 $requirements = array();
41
42 if (module_exists('i18n') && variable_get('i18n_selection_mode', 'simple') != 'off') {
43 $requirements['active_translation_i18n'] = array(
44 'title' => t('Active Translation'),
45 'value' => t('Incompatible with i18n query rewriting'),
46 'severity' => REQUIREMENT_ERROR,
47 'description' => t("The active translation module is incompatible with the Internationalization module's query rewriting. Change the <em>Content selection</em> setting to <em>All content</em> in the <a href='!i18n-settings-link'>Multilingual system settings</a> page.", array('!i18n-settings-link' => url('admin/settings/language/i18n'))),
48 );
49 }
50
51 return $requirements;
52 }
53
54
55 /**
56 * Implementation of hook_schema().
57 */
58 function active_translation_schema() {
59 // The primary field/index.
60 $schema['active_translation'] = array(
61 'description' => t('The table for tracking which node is the active translation for a given language.'),
62 'fields' => array(
63 'atid' => array(
64 'description' => t('The identifier for a node or set of node translations.'),
65 'type' => 'int',
66 'unsigned' => TRUE,
67 'not null' => TRUE,
68 ),
69 ),
70 'primary key' => array('atid'),
71 );
72
73 // And dynamically assemble the table with a column per languages. Call
74 // language_list() with $reset = TRUE in case the languages have changed.
75 foreach (language_list('language', TRUE) as $lang_code => $language) {
76 $field = db_escape_table($lang_code);
77 $schema['active_translation']['fields'][$field] = array(
78 'description' => t('The node id of the that should be used when %language is the active language.', array('%language' => t($language->name))),
79 'type' => 'int',
80 'unsigned' => TRUE,
81 'not null' => TRUE,
82 );
83 $schema['active_translation']['indexes'][$field] = array($field);
84 }
85
86 return $schema;
87 }

  ViewVC Help
Powered by ViewVC 1.1.2