summaryrefslogtreecommitdiff
path: root/modules/translation/translation.module
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-01-22 03:11:54 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-01-22 03:11:54 +0000
commitb4c737a2a5ed9bf9905c91107f94e42df36f2c44 (patch)
tree8bed38a803bf4f1c8dc1e657f42abe9cc2fd952d /modules/translation/translation.module
parent7ac380aa059bd901e7965445080d2fddef84f9e9 (diff)
downloadbrdo-b4c737a2a5ed9bf9905c91107f94e42df36f2c44.tar.gz
brdo-b4c737a2a5ed9bf9905c91107f94e42df36f2c44.tar.bz2
#287178 by justinrandell: Break up various hook_form_alter()s to hook_form_FORM_ID_alters().
Diffstat (limited to 'modules/translation/translation.module')
-rw-r--r--modules/translation/translation.module20
1 files changed, 12 insertions, 8 deletions
diff --git a/modules/translation/translation.module b/modules/translation/translation.module
index 0057dfb82..35fe82582 100644
--- a/modules/translation/translation.module
+++ b/modules/translation/translation.module
@@ -94,20 +94,24 @@ function translation_perm() {
}
/**
+ * Implementation of hook_form_FORM_ID_alter().
+ */
+function translation_form_node_type_form_alter(&$form, &$form_state) {
+ // Add translation option to content type form.
+ $form['workflow']['language_content_type']['#options'][TRANSLATION_ENABLED] = t('Enabled, with translation');
+ // Description based on text from locale.module.
+ $form['workflow']['language_content_type']['#description'] = t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the <a href="!languages">enabled languages</a>. You can also turn on translation for this content type, which lets you have content translated to any of the enabled languages. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/settings/language')));
+}
+
+/**
* Implementation of hook_form_alter().
*
* - Add translation option to content type form.
* - Alters language fields on node forms when a translation
* is about to be created.
*/
-function translation_form_alter(&$form, $form_state, $form_id) {
- if ($form_id == 'node_type_form') {
- // Add translation option to content type form.
- $form['workflow']['language_content_type']['#options'][TRANSLATION_ENABLED] = t('Enabled, with translation');
- // Description based on text from locale.module.
- $form['workflow']['language_content_type']['#description'] = t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the <a href="!languages">enabled languages</a>. You can also turn on translation for this content type, which lets you have content translated to any of the enabled languages. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/settings/language')));
- }
- elseif (isset($form['#id']) && $form['#id'] == 'node-form' && translation_supported_type($form['#node']->type)) {
+function translation_form_alter(&$form, &$form_state, $form_id) {
+ if (isset($form['#id']) && $form['#id'] == 'node-form' && translation_supported_type($form['#node']->type)) {
$node = $form['#node'];
if (!empty($node->translation_source)) {
// We are creating a translation. Add values and lock language field.