| 1 |
<?php
|
| 2 |
/**
|
| 3 |
* Installation script for i18ncontent module
|
| 4 |
*/
|
| 5 |
function i18ncontent_install() {
|
| 6 |
// Create strings in the extended localization system
|
| 7 |
foreach (node_get_types() as $type) {
|
| 8 |
tt("nodetype:$type->type:name", $type->name, NULL, TRUE);
|
| 9 |
tt("nodetype:$type->type:title", $type->title_label, NULL, TRUE);
|
| 10 |
tt("nodetype:$type->type:title", $type->body_label, NULL, TRUE);
|
| 11 |
if ($type->help) {
|
| 12 |
ts("nodetype:$type->type:help", $type->help, NULL, TRUE);
|
| 13 |
$type->help = '';
|
| 14 |
node_type_save($type);
|
| 15 |
}
|
| 16 |
}
|
| 17 |
}
|
| 18 |
|
| 19 |
/**
|
| 20 |
* Implementation of hook_uninstall()
|
| 21 |
*/
|
| 22 |
function i18ncontent_uninstall() {
|
| 23 |
// Remove and restore help texts
|
| 24 |
$language = language_default('language');
|
| 25 |
foreach (node_get_types() as $type) {
|
| 26 |
if (!$type->help && ($help = st("nodetype:$type->type:help", $language))) {
|
| 27 |
$type->help = $help;
|
| 28 |
node_type_save($type);
|
| 29 |
}
|
| 30 |
}
|
| 31 |
// @ TODO Some more clean up for strings
|
| 32 |
}
|
| 33 |
|
| 34 |
/**
|
| 35 |
* The old module with the same name had a different approach, so the update will be full install
|
| 36 |
*/
|
| 37 |
function i18ncontent_update_1() {
|
| 38 |
$ret = array();
|
| 39 |
i18ncontent_install();
|
| 40 |
return $ret;
|
| 41 |
}
|