function i18ncontent_node_type in Internationalization 6
Same name and namespace in other branches
- 5.3 experimental/i18ncontent.module \i18ncontent_node_type()
Implementation of hook_node_type().
File
- i18ncontent/
i18ncontent.module, line 126 - Internationalization (i18n) package - translatable content type parameters
Code
function i18ncontent_node_type($op, $info) {
$language = language_default('language');
if ($op == 'insert' || $op == 'update') {
if (!empty($info->old_type) && $info->old_type != $info->type) {
i18nstrings_update_context("nodetype:type:{$old_type}:*", "nodetype:type:{$type}:*");
}
i18nstrings_update("nodetype:type:{$info->type}:name", $info->name);
i18nstrings_update("nodetype:type:{$info->type}:title", $info->title_label);
i18nstrings_update("nodetype:type:{$info->type}:body", $info->body_label);
i18nstrings_update("nodetype:type:{$info->type}:description", $info->description);
if (empty($info->help)) {
i18nstrings_remove("nodetype:type:{$info->type}:help");
}
else {
i18nstrings_ts("nodetype:type:{$info->type}:help", $info->help, $language, TRUE);
// Remove the 'help' text from {node_type} to avoid both the
// original text and translation appearing in hook_help().
db_query("UPDATE {node_type} set help = '' WHERE type = '%s'", $info->type);
}
}
if ($op == 'delete') {
i18nstrings_remove("nodetype:type:{$info->type}:title");
i18nstrings_remove("nodetype:type:{$info->type}:name");
i18nstrings_remove("nodetype:type:{$info->type}:description");
i18nstrings_remove("nodetype:type:{$info->type}:body");
i18nstrings_remove("nodetype:type:{$info->type}:help");
}
}