diff --git a/metatag.inc b/metatag.inc index 53e7dac..c6603e4 100644 --- a/metatag.inc +++ b/metatag.inc @@ -146,6 +146,213 @@ class DrupalTextMetaTag extends DrupalDefaultMetaTag { } /** + * Extended meta tag controller for tags supporting the full attribute set. + */ +class DrupalExtendedMetaTag extends DrupalTextMetaTag { + + /** + * Implements DrupalMetaTagInterface::getForm(). + */ + public function getForm(array $options = array()) { + + $options += array( + 'token types' => array(), + ); + + $form['item'] = array( + '#type' => 'fieldset', + '#title' => $this->info['label'], + '#tree' => TRUE, + '#description' => !empty($this->info['description']) ? $this->info['description'] : '', + '#attributes' => array('class' => array('metatag-item', 'extended-metatag-item')), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + $form['item']['value'] = isset($this->info['form']['value']) ? $this->info['form']['value'] : array(); + + // Check for old single value format. + if (!empty($this->data['value'])) { + $this->data['item']['value'] = $this->data['value']; + } + + $form['item']['value'] += array( + '#type' => 'textfield', + '#title' => t('Value'), + '#attributes' => array('class' => array('extended-metatag-field')), + '#default_value' => isset($this->data['item']['value']) ? $this->data['item']['value'] : '', + '#element_validate' => array('token_element_validate'), + '#token_types' => $options['token types'], + '#maxlength' => 1024, + '#length' => '60', + ); + + $form['item']['scheme'] = isset($this->info['form']['scheme']) ? $this->info['form']['scheme'] : array(); + + $form['item']['scheme'] += array( + '#type' => 'textfield', + '#title' => t('Scheme'), + '#attributes' => array('class' => array('extended-metatag-field', 'metatag-exclude')), + '#default_value' => isset($this->data['item']['scheme']) ? $this->data['item']['scheme'] : '', + '#element_validate' => array('token_element_validate'), + '#token_types' => $options['token types'], + '#maxlength' => 1024, + '#description' => t('Some metadata standards specify encoding schemes, which you can include here if required.'), + ); + + $form['item']['lang'] = isset($this->info['form']['lang']) ? $this->info['form']['lang'] : array(); + + $form['item']['lang'] += array( + '#type' => 'textfield', + '#title' => t('Language'), + '#attributes' => array('class' => array('extended-metatag-field', 'metatag-exclude')), + '#description' => t("The lang attribute's value is a language code that identifies a natural language spoken, written, or otherwise used for the communication of information among people."), + '#default_value' => isset($this->data['item']['lang']) ? $this->data['item']['lang'] : '', + '#element_validate' => array('token_element_validate'), + '#token_types' => $options['token types'], + '#maxlength' => 1024, + ); + + $form['item']['dir'] = isset($this->info['form']['dir']) ? $this->info['form']['dir'] : array(); + + $form['item']['dir'] += array( + '#type' => 'select', + '#title' => t('Text direction'), + '#attributes' => array('class' => array('extended-metatag-field', 'metatag-exclude')), + '#description' => t("Specifies the base direction of directionally neutral text."), + '#default_value' => isset($this->data['item']['dir']) ? $this->data['item']['dir'] : '', + '#options' => array( + FALSE => '- none -', + 'ltr' => t('Left to right'), + 'rtl' => t('Right to left'), + ), + '#maxlength' => 1024, + ); + + return $form; + } + + /** + * Implements DrupalMetaTagInterface::getValue(). + */ + public function getValue(array $options = array()) { + $name = "metatag:" . $options["instance"] . ":" . $this->info["name"]; + + $options += array( + 'token data' => array(), + 'clear' => TRUE, + 'sanitize' => TRUE, + 'raw' => FALSE, + ); + + // Check for old single value format. + if (!empty($this->data['value'])) { + $this->data['item']['value'] = $this->data['value']; + } + + if (!isset($this->data['item']['value'])) { + return NULL; + } + + $value = metatag_translate($name, $this->data['item']['value']); + if (empty($options['raw'])) { + // Give other modules the opportunity to use hook_metatag_pattern_alter() + // to modify defined token patterns and values before replacement. + drupal_alter('metatag_pattern', $value, $options['token data']); + $value = token_replace($value, $options['token data'], $options); + } + + $value = $this->tidyValue($value); + + return $value; + } + + /** + * Return the item attributes for the extended tag. + * + * @param array $options + * (optional) An array of options. + * + * @return array + * An array of values. + */ + public function getAttributes(array $options = array()) { + + $options += array( + 'token data' => array(), + 'clear' => TRUE, + 'sanitize' => TRUE, + 'raw' => FALSE, + ); + + $values = $this->data['item']; + + unset($values['value']); + + foreach ($values as $name => $value) { + if (empty($value)) { + unset($values[$name]); + } + } + + if (isset($values['lang'])) { + $values['xml:lang'] = $values['lang']; + } + + foreach ($values as $key => $value) { + if (empty($options['raw'])) { + $value = token_replace($value, $options['token data'], $options); + } + + $values[$key] = $this->tidyValue($value); + } + + return $values; + } + + /** + * Implements DrupalMetaTagInterface::getElement(). + */ + public function getElement(array $options = array()) { + + $element = isset($this->info['element']) ? $this->info['element'] : array(); + + $value = $this->getValue($options); + if (strlen($value) === 0) { + return array(); + } + + $element += array( + '#theme' => 'metatag', + '#tag' => 'meta', + '#id' => 'metatag_' . $this->info['name'], + '#name' => $this->info['name'], + '#value' => $value, + '#attributes' => $this->getAttributes($options), + ); + + // Add header information if desired. + if (!empty($this->info['header'])) { + $element['#attached']['drupal_add_http_header'][] = array( + $this->info['header'], + $value, + ); + } + + return array( + '#attached' => array( + 'drupal_add_html_head' => array( + array( + $element, + $element['#id'], + ), + ), + ), + ); + } +} + + +/** * Link type meta tag controller. */ class DrupalLinkMetaTag extends DrupalTextMetaTag { diff --git a/metatag.migrate.inc b/metatag.migrate.inc index efa603a..b2d2900 100644 --- a/metatag.migrate.inc +++ b/metatag.migrate.inc @@ -116,7 +116,14 @@ class MigrateMetatagHandler extends MigrateDestinationHandler { foreach ($elements['tags'] as $value) { $metatag_field = 'metatag_' . $value['name']; if (isset($entity->$metatag_field)) { - $entity->metatags[$value['name']]['value'] = $entity->$metatag_field; + + if (is_array($entity->$metatag_field)) { + $entity->metatags[$value['name']]['item'] = $entity->$metatag_field; + } + else { + $entity->metatags[$value['name']]['value'] = $entity->$metatag_field; + } + unset($entity->$metatag_field); } } diff --git a/metatag.module b/metatag.module index 54f3bdf..9290abc 100644 --- a/metatag.module +++ b/metatag.module @@ -888,6 +888,11 @@ function metatag_metatags_form(array &$form, $instance, array $metatags = array( // Get the form element from the meta tag class. $metatag_form = $metatag_instance->getForm($options); + // Adds DrupalExtendedMetaTag item value if available. + if (isset($options['defaults'][$metatag]['item']['value'])) { + $options['defaults'][$metatag]['value'] = $options['defaults'][$metatag]['item']['value']; + } + // Add a default value form element. if (isset($options['defaults'][$metatag]['value'])) { $metatag_form['default'] = array( @@ -1540,18 +1545,43 @@ function metatag_config_instance_info($instance = NULL) { */ function metatag_filter_values_from_defaults(array &$values, array $defaults = array()) { foreach ($values as $metatag => $data) { + $default = isset($data['default']) ? $data['default'] : (isset($defaults[$metatag]['value']) ? $defaults[$metatag]['value'] : NULL); - if (isset($default) && isset($data['value']) && $default === $data['value']) { - // Meta tag has a default, and it matches user-submitted value. - unset($values[$metatag]); - } - elseif (!isset($default) && (is_string($data['value']) && !drupal_strlen($data['value']) || (is_array($data['value']) && !array_filter($data['value'])))) { - // Metatag does not have a default, and user did not submit a value. - unset($values[$metatag]); + + if (isset($data['value']) && is_array($data['value'])) { + foreach ($data['value'] as $property => $value) { + + if (isset($default[$property]) && isset($data['value'][$property]) && $default[$property] === $data['value'][$property]) { + // Meta tag has a default, and it matches user-submitted value. + unset($values[$metatag][$property]); + } + elseif (!isset($default[$property]) && (is_string($data['value'][$property]) && !drupal_strlen($data['value'][$property]) || (is_array($data['value'][$property]) && !array_filter($data['value'][$property])))) { + // Metatag does not have a default, and user did not submit a value. + unset($values[$metatag][$property]); + } + + if (isset($values[$metatag]['default'][$property])) { + // Unset the default hidden value. + unset($values[$metatag]['default'][$property]); + } + } } - if (isset($values[$metatag]['default'])) { - // Unset the default hidden value. - unset($values[$metatag]['default']); + else { + if (isset($data['value'])) { + if (!empty($default) && $default === $data['value']) { + // Meta tag has a default, and it matches user-submitted value. + unset($values[$metatag]); + } + elseif (!isset($default) && (is_string($data['value']) && !drupal_strlen($data['value']) || (is_array($data['value']) && !array_filter($data['value'])))) { + // Metatag does not have a default, and user did not submit a value. + unset($values[$metatag]); + } + } + + if (isset($values[$metatag]['default'])) { + // Unset the default hidden value. + unset($values[$metatag]['default']); + } } } } diff --git a/metatag.vertical-tabs.js b/metatag.vertical-tabs.js index b207b2c..9de59fd 100644 --- a/metatag.vertical-tabs.js +++ b/metatag.vertical-tabs.js @@ -5,8 +5,16 @@ Drupal.behaviors.metatagFieldsetSummaries = { attach: function (context) { $('fieldset.metatags-form', context).drupalSetSummary(function (context) { var vals = []; - $("input[type='text'], select, textarea", context).each(function() { - var default_name = $(this).attr('name').replace(/\[value\]/, '[default]'); + $("input[type='text'], select, textarea", context).not('.metatag-exclude').each(function() { + if ($(this).hasClass('extended-metatag-field')) { + var default_name = $(this).attr('name').replace(/\[item\]/, '').replace(/\[value\]/, '[default]'); + var label = $(this).closest('.extended-metatag-item').find('a.fieldset-title').text().replace(/^Hide|Show/, ''); + } + else { + var default_name = $(this).attr('name').replace(/\[value\]/, '[default]'); + var label = $("label[for='" + $(this).attr('id') + "']").text(); + } + var default_value = $("input[type='hidden'][name='" + default_name + "']", context); if (default_value.length && default_value.val() == $(this).val()) { // Meta tag has a default value and form value matches default value. @@ -16,7 +24,6 @@ Drupal.behaviors.metatagFieldsetSummaries = { // Meta tag has no default value and form value is empty. return true; } - var label = $("label[for='" + $(this).attr('id') + "']").text(); vals.push(Drupal.t('@label: @value', { '@label': $.trim(label), '@value': Drupal.truncate($(this).val(), 25) || Drupal.t('None') diff --git a/metatag_dc/metatag_dc.install b/metatag_dc/metatag_dc.install new file mode 100644 index 0000000..d5d3c4e --- /dev/null +++ b/metatag_dc/metatag_dc.install @@ -0,0 +1,171 @@ +fields('m') + ->execute() + ->fetchAll(); + $sandbox['records'] = array(); + foreach ($nodes as $record) { + $sandbox['records'][] = $record; + } + + // If there's no data, don't bother with the extra work. + if (empty($sandbox['records'])) { + watchdog('metatag_dc', 'Update ' . $update_number . ': No nodes need the Metatag values fixed.', array(), WATCHDOG_INFO); + if (drupal_is_cli()) { + drupal_set_message(t('Update %num: No nodes need the Metatag values fixed.', array( + '%num' => $update_number, + ))); + } + + return t('No nodes need the Metatag values fixed.'); + } + + // Total records that must be visited. + $sandbox['max'] = count($sandbox['records']); + + // A place to store messages during the run. + $sandbox['messages'] = array(); + + // An initial record of the number of records to be updated. + watchdog('metatag_dc', 'Update ' . $update_number . ': !count records to update.', array('!count' => $sandbox['max']), WATCHDOG_INFO); + if (drupal_is_cli()) { + drupal_set_message(t('Update %num: !count records to update.', array( + '%num' => $update_number, + '!count' => $sandbox['max'], + ))); + } + + // Last record processed. + $sandbox['current_record'] = -1; + + // Because a lot of other processing happens on the first iteration, just do + // one. + $limit = 1; + } + + // The for loop will run as normal when ran via update.php, but when ran via + // Drush it'll just run 'til it's finished. + $increment = 1; + if (drupal_is_cli()) { + $increment = 0; + } + + // Set default values. + for ($ctr = 0; $ctr < $limit; $ctr += $increment) { + $sandbox['current_record']++; + if (empty($sandbox['records'][$sandbox['current_record']])) { + break; + } + + $sandbox['records'][$sandbox['current_record']]->data = unserialize($sandbox['records'][$sandbox['current_record']]->data); + + if (function_exists($batch_callback) || is_callable($sandbox['records'][$sandbox['current_record']])) { + $sandbox['records'][$sandbox['current_record']] = $batch_callback($sandbox['records'][$sandbox['current_record']]); + } + + db_update('metatag') + ->fields(array('data' => serialize($sandbox['records'][$sandbox['current_record']]->data))) + ->condition('entity_type', 'node') + ->condition('entity_id', $sandbox['records'][$sandbox['current_record']]->entity_id) + ->execute(); + + // Update our progress information. + $sandbox['progress']++; + } + + // Set the "finished" status, to tell batch engine whether this function + // needs to run again. If you set a float, this will indicate the progress of + // the batch so the progress bar will update. + $sandbox['#finished'] = ($sandbox['progress'] >= $sandbox['max']) ? TRUE : ($sandbox['progress'] / $sandbox['max']); + + if ($sandbox['#finished']) { + // Clear all caches so the fixed data will be reloaded. + cache_clear_all('*', 'cache_metatag', TRUE); + + // A final log of the number of records that were converted. + watchdog('metatag_dc', 'Update ' . $update_number . ': !count records were updated in total.', array('!count' => $sandbox['progress']), WATCHDOG_INFO); + if (drupal_is_cli()) { + drupal_set_message(t('Update %num: !count records were updated.', array( + '%num' => $update_number, + '!count' => $sandbox['progress'], + ))); + } + + // hook_update_N() may optionally return a string which will be displayed + // to the user. + return t('Fixed the Metatag values for @count nodes.', array('@count' => $sandbox['progress'])); + } +} + +/** + * Fix tags. + */ +function _metatag_dc_fix_tag_names($record) { + + if (!empty($record->data)) { + foreach ($record->data as $tag_name => $tag_data) { + // Determine if this tag specifies a schema. + if (strpos($tag_name, '.')) { + list($schema, $schema_property) = explode('.', $tag_name); + } + elseif (strpos($tag_name, ':')) { + list($schema, $schema_property) = explode(':', $tag_name); + } + else { + continue; + } + + // Correct DCTERMS, which changed case when moved to metatag_dc. + if ($schema == 'DCTERMS') { + unset($record->data[$tag_name]); + + $record->data[strtolower($tag_name)] = $tag_data; + } + } + } + + return $record; +} diff --git a/metatag_dc/metatag_dc.metatag.inc b/metatag_dc/metatag_dc.metatag.inc index 7f8094d..12418a2 100644 --- a/metatag_dc/metatag_dc.metatag.inc +++ b/metatag_dc/metatag_dc.metatag.inc @@ -12,43 +12,43 @@ function metatag_dc_metatag_config_default_alter(array &$configs) { switch ($config->instance) { case 'global': $config->config += array( - 'dcterms.title' => array('value' => '[current-page:title]'), - 'dcterms.type' => array('value' => 'Text'), - 'dcterms.format' => array('value' => 'text/html'), + 'dcterms.title' => array('item' => array('value' => '[current-page:title]')), + 'dcterms.type' => array('item' => array('value' => 'Text')), + 'dcterms.format' => array('item' => array('value' => 'text/html')), ); break; case 'global:frontpage': $config->config += array( - 'dcterms.title' => array('value' => '[site:name]'), - 'dcterms.identifier' => array('value' => '[site:url]'), + 'dcterms.title' => array('item' => array('value' => '[site:name]')), + 'dcterms.identifier' => array('item' => array('value' => '[site:url]')), ); break; case 'node': $config->config += array( - 'dcterms.title' => array('value' => '[node:title]'), - 'dcterms.date' => array('value' => '[node:created:custom:Y-m-d\TH:iP]'), - 'dcterms.identifier' => array('value' => '[current-page:url:absolute]'), - 'dcterms.language' => array('value' => '[node:language]'), - 'dcterms.creator' => array('value' => '[node:author]'), + 'dcterms.title' => array('item' => array('value' => '[node:title]')), + 'dcterms.date' => array('item' => array('value' => '[node:created:custom:Y-m-d\TH:iP]')), + 'dcterms.identifier' => array('item' => array('value' => '[current-page:url:absolute]')), + 'dcterms.language' => array('item' => array('value' => '[node:language]')), + 'dcterms.creator' => array('item' => array('value' => '[node:author]')), ); break; case 'taxonomy_term': $config->config += array( - 'dcterms.title' => array('value' => '[term:name]'), - 'dcterms.identifier' => array('value' => '[current-page:url:absolute]'), - 'dcterms.description' => array('value' => '[term:description]'), + 'dcterms.title' => array('item' => array('value' => '[term:name]')), + 'dcterms.identifier' => array('item' => array('value' => '[current-page:url:absolute]')), + 'dcterms.description' => array('item' => array('value' => '[term:description]')), ); break; case 'user': $config->config += array( - 'dcterms.title' => array('value' => '[user:name]'), - 'dcterms.date' => array('value' => '[user:created:custom:Y-m-d\TH:iP]'), - 'dcterms.identifier' => array('value' => '[current-page:url:absolute]'), - 'dcterms.creator' => array('value' => '[user:name]'), + 'dcterms.title' => array('item' => array('value' => '[user:name]')), + 'dcterms.date' => array('item' => array('value' => '[user:created:custom:Y-m-d\TH:iP]')), + 'dcterms.identifier' => array('item' => array('value' => '[current-page:url:absolute]')), + 'dcterms.creator' => array('item' => array('value' => '[user:name]')), ); break; } @@ -70,143 +70,100 @@ function metatag_dc_metatag_info() { $info['tags']['dcterms.title'] = array( 'label' => t('Dublin Core Title'), 'description' => t('The name given to the resource.'), - 'class' => 'DrupalTextMetaTag', + 'class' => 'DrupalExtendedMetaTag', 'group' => 'dublin-core', 'element' => array( '#type' => 'term', - '#theme' => 'metatag_dc', ), ); $info['tags']['dcterms.creator'] = array( 'label' => t('Dublin Core Creator'), 'description' => t('An entity primarily responsible for making the resource. Examples of a Creator include a person, an organization, or a service. Typically, the name of a Creator should be used to indicate the entity.'), 'group' => 'dublin-core', - 'class' => 'DrupalTextMetaTag', - 'element' => array( - '#theme' => 'metatag_dc', - ), + 'class' => 'DrupalExtendedMetaTag', ); $info['tags']['dcterms.subject'] = array( 'label' => t('Dublin Core Subject'), 'description' => t('The topic of the resource. Typically, the subject will be represented using keywords, key phrases, or classification codes. Recommended best practice is to use a controlled vocabulary. To describe the spatial or temporal topic of the resource, use the Coverage element.'), - 'class' => 'DrupalTextMetaTag', + 'class' => 'DrupalExtendedMetaTag', 'group' => 'dublin-core', - 'element' => array( - '#theme' => 'metatag_dc', - ), ); $info['tags']['dcterms.description'] = array( 'label' => t('Dublin Core Description'), 'description' => t('An account of the resource. Description may include but is not limited to: an abstract, a table of contents, a graphical representation, or a free-text account of the resource.'), 'group' => 'dublin-core', - 'class' => 'DrupalTextMetaTag', - 'element' => array( - '#theme' => 'metatag_dc', - ), + 'class' => 'DrupalExtendedMetaTag', ); $info['tags']['dcterms.publisher'] = array( 'label' => t('Dublin Core Publisher'), 'description' => t('An entity responsible for making the resource available. Examples of a Publisher include a person, an organization, or a service. Typically, the name of a Publisher should be used to indicate the entity.'), 'group' => 'dublin-core', - 'class' => 'DrupalTextMetaTag', - 'element' => array( - '#theme' => 'metatag_dc', - ), + 'class' => 'DrupalExtendedMetaTag', ); $info['tags']['dcterms.contributor'] = array( 'label' => t('Dublin Core Contributor'), 'description' => t('An entity responsible for making contributions to the resource. Examples of a Contributor include a person, an organization, or a service. Typically, the name of a Contributor should be used to indicate the entity.'), 'group' => 'dublin-core', - 'class' => 'DrupalTextMetaTag', - 'element' => array( - '#theme' => 'metatag_dc', - ), + 'class' => 'DrupalExtendedMetaTag', ); $info['tags']['dcterms.date'] = array( 'label' => t('Dublin Core Date'), 'description' => t('A point or period of time associated with an event in the lifecycle of the resource. Date may be used to express temporal information at any level of granularity. Recommended best practice is to use an encoding scheme, such as the W3CDTF profile of ISO 8601 [W3CDTF].'), - 'class' => 'DrupalTextMetaTag', + 'class' => 'DrupalExtendedMetaTag', 'group' => 'dublin-core', - 'element' => array( - '#theme' => 'metatag_dc', - ), ); $info['tags']['dcterms.type'] = array( 'label' => t('Dublin Core Type'), 'description' => t('The nature or genre of the resource. Recommended best practice is to use a controlled vocabulary such as the DCMI Type Vocabulary [DCMITYPE]. To describe the file format, physical medium, or dimensions of the resource, use the Format element.'), - 'class' => 'DrupalTextMetaTag', + 'class' => 'DrupalExtendedMetaTag', 'group' => 'dublin-core', 'form' => array( '#type' => 'select', '#options' => _metatag_dc_dcmi_type_vocabulary_options(), '#empty_option' => t('- None -'), ), - 'element' => array( - '#theme' => 'metatag_dc', - ), ); $info['tags']['dcterms.format'] = array( 'label' => t('Dublin Core Format'), 'description' => t('The file format, physical medium, or dimensions of the resource. Examples of dimensions include size and duration. Recommended best practice is to use a controlled vocabulary such as the list of Internet Media Types [MIME].'), - 'class' => 'DrupalTextMetaTag', + 'class' => 'DrupalExtendedMetaTag', 'group' => 'dublin-core', - 'element' => array( - '#theme' => 'metatag_dc', - ), ); $info['tags']['dcterms.identifier'] = array( 'label' => t('Dublin Core Identifier'), 'description' => t('An unambiguous reference to the resource within a given context. Recommended best practice is to identify the resource by means of a string conforming to a formal identification system.'), - 'class' => 'DrupalTextMetaTag', + 'class' => 'DrupalExtendedMetaTag', 'group' => 'dublin-core', - 'element' => array( - '#theme' => 'metatag_dc', - ), ); $info['tags']['dcterms.source'] = array( 'label' => t('Dublin Core Source'), 'description' => t('A related resource from which the described resource is derived. The described resource may be derived from the related resource in whole or in part. Recommended best practice is to identify the related resource by means of a string conforming to a formal identification system.'), 'group' => 'dublin-core', - 'class' => 'DrupalTextMetaTag', - 'element' => array( - '#theme' => 'metatag_dc', - ), + 'class' => 'DrupalExtendedMetaTag', ); $info['tags']['dcterms.language'] = array( 'label' => t('Dublin Core Language'), 'description' => t('A language of the resource. Recommended best practice is to use a controlled vocabulary such as RFC 4646 [RFC4646].'), - 'class' => 'DrupalTextMetaTag', + 'class' => 'DrupalExtendedMetaTag', 'group' => 'dublin-core', - 'element' => array( - '#theme' => 'metatag_dc', - ), ); $info['tags']['dcterms.relation'] = array( 'label' => t('Dublin Core Relation'), 'description' => t('A related resource. Recommended best practice is to identify the related resource by means of a string conforming to a formal identification system.'), 'group' => 'dublin-core', - 'class' => 'DrupalTextMetaTag', - 'element' => array( - '#theme' => 'metatag_dc', - ), + 'class' => 'DrupalExtendedMetaTag', ); $info['tags']['dcterms.coverage'] = array( 'label' => t('Dublin Core Coverage'), 'description' => t('The spatial or temporal topic of the resource, the spatial applicability of the resource, or the jurisdiction under which the resource is relevant. Spatial topic and spatial applicability may be a named place or a location specified by its geographic coordinates. Temporal topic may be a named period, date, or date range. A jurisdiction may be a named administrative entity or a geographic place to which the resource applies. Recommended best practice is to use a controlled vocabulary such as the Thesaurus of Geographic Names [TGN]. Where appropriate, named places or time periods can be used in preference to numeric identifiers such as sets of coordinates or date ranges.'), 'group' => 'dublin-core', - 'class' => 'DrupalTextMetaTag', - 'element' => array( - '#theme' => 'metatag_dc', - ), + 'class' => 'DrupalExtendedMetaTag', ); $info['tags']['dcterms.rights'] = array( 'label' => t('Dublin Core Rights'), 'description' => t('Information about rights held in and over the resource. Typically, rights information includes a statement about various property rights associated with the resource, including intellectual property rights.'), 'group' => 'dublin-core', - 'class' => 'DrupalTextMetaTag', - 'element' => array( - '#theme' => 'metatag_dc', - ), + 'class' => 'DrupalExtendedMetaTag', ); return $info; diff --git a/metatag_dc/metatag_dc.module b/metatag_dc/metatag_dc.module index 8c15070..b41a573 100644 --- a/metatag_dc/metatag_dc.module +++ b/metatag_dc/metatag_dc.module @@ -12,28 +12,3 @@ function metatag_dc_ctools_plugin_api($owner, $api) { return array('version' => 1); } } - -/** - * Implements hook_theme(). - */ -function metatag_dc_theme() { - $info['metatag_dc'] = array( - 'render element' => 'element', - ); - - return $info; -} - -/** - * Theme callback for a Dublin Core meta tag. - */ -function theme_metatag_dc($variables) { - $element = &$variables['element']; - element_set_attributes($element, array( - '#name' => 'name', - '#schema' => 'schema', - '#value' => 'content') - ); - unset($element['#value']); - return theme('html_tag', $variables); -}