From 06b06f612b15f897905d52519d836bd15d61075b Mon Sep 17 00:00:00 2001 From: Colan Schwartz Date: Tue, 17 Jul 2012 11:45:36 -0400 Subject: [PATCH] Issue #1688286 by colan: Add language-specific tags. --- metatag.install | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/metatag.install b/metatag.install index 47518f9..e0f5ee0 100644 --- a/metatag.install +++ b/metatag.install @@ -110,3 +110,36 @@ function metatag_update_7001() { ); db_change_field('metatag_config', 'cid', 'cid', $field); } + +/** + * Add the {metatag}.language field. + */ +function metatag_update_7002() { + + // Set the target table and field name. + $table_name = 'metatag'; + $field_name = 'language'; + + // Don't add the new field if it already exists. + if (db_field_exists($table_name, $field_name)) { + return; + } + + // Describe the new field. + $field_definition = array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The target language for this tag.', + ); + + // Add it. + db_add_field($table_name, $field_name, $field_definition); + + // Set default values. + db_update($table_name) + ->fields(array($field_name => language_default('language'))) + ->execute(); +} + -- 1.7.0.4