diff --git a/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.admin.inc b/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.admin.inc new file mode 100644 index 00000000..b5f8c299 --- /dev/null +++ b/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.admin.inc @@ -0,0 +1,31 @@ + 'select', + '#title' => t('Dublin Core Prefix'), + '#description' => t('Choose a prefix to be rendered on page display.'), + '#options' => array( + 'DCTERMS' => 'dcterms', + 'DC' => 'dc', + ), + '#default_value' => _metadata_dc_prefix(), + ); + $form['#submit'][] = 'wetkit_metatag_submit'; + + return system_settings_form($form); +} + +/** + * Submit callback for Dublin Core configuration. + */ +function wetkit_metatag_submit() { + // Give feedback to the user to reset the cache to take effect. + drupal_set_message("The cache needs to be cleared for this setting to take effect."); +} diff --git a/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.info b/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.info index f8d36a4c..f4c5fae6 100644 --- a/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.info +++ b/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.info @@ -1,8 +1,9 @@ -name = "WetKit MetaTags" -description = "Core Feature: Installs and configures default metatags that can be easily extended for your site" -core = "7.x" -package = "WetKit" -php = "5.2.4" -version = "7.x-1.0" -dependencies[] = "metatag" -features['features_api']['api:1'] = TRUE; \ No newline at end of file +name = WetKit MetaTags Dublin Core (HTML5) +description = Installs and configures default wetkit metatags that can be easily extended for your site +core = 7.x +package = WetKit +php = 5.2.4 +version = 7.x-1.0 +dependencies[] = i18n +dependencies[] = i18n_variable +dependencies[] = metatag \ No newline at end of file diff --git a/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.metatag.inc b/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.metatag.inc index 1f04a4ff..7a1bf169 100644 --- a/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.metatag.inc +++ b/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.metatag.inc @@ -1,5 +1,4 @@ instance) { case 'global': $config->config += array( - 'tmp.title' => array('value' => '[current-page:title]'), - 'dc.title' => array('value' => '[current-page:title]'), - 'dc.site_name' => array('value' => '[site:name]'), - 'dc.url' => array('value' => '[current-page:url]'), - 'dc.creator' => array('value' => i18n_variable_get('sitename', $language->language)), - 'dc.language' => array('value' => wetkit_current_lang()), + $prefix . '.title' => array('value' => '[current-page:title]'), + $prefix . '.language' => array('value' => ($language->language == 'en') ? 'eng' : 'fra'), + // TODO - Still Need to Review + //$prefix . '.format' => array('value' => 'text/html'), + //$prefix . '.type' => array('value' => 'Text'), + //$prefix . '.creator' => array('value' => i18n_variable_get('sitename', $language->language)), ); break; + case 'global:frontpage': $config->config += array( - 'tmp.title' => array('value' => '[site:name]'), - 'dc.title' => array('value' => '[site:name]'), - 'dc.url' => array('value' => '[site:url]'), + $prefix . '.title' => array('value' => '[site:name]'), + $prefix . '.identifier' => array('value' => '[site:url]'), ); break; + case 'node': $config->config += array( - 'dc.title' => array('value' => '[node:title]'), - 'dc.description' => array('value' => '[node:summary]'), - 'dc.url' => array('value' => '[current-page:url]'), - 'date' => array('value' => '[node:changed]'), - 'dcterms.issued' => array('value' => '[node:created]'), - 'dcterms.modified' => array('value' => '[node:changed]'), - 'author' => array('value' => '[node:author]'), + $prefix . '.title' => array('value' => '[node:title]'), + $prefix . '.issued' => array('value' => '[node:created:custom:Y-m-d\TH:iP]'), + $prefix . '.modified' => array('value' => '[node:changed:custom:Y-m-d\TH:iP]'), + $prefix . '.identifier' => array('value' => '[site:url]/node/[node:nid]'), + $prefix . '.creator' => array('value' => '[node:author]'), + $prefix . '.description' => array('value' => '[node:summary]'), ); break; + case 'taxonomy_term': $config->config += array( - 'dc.title' => array('value' => '[term:name]'), - 'dc.description' => array('value' => '[term:description]'), + $prefix . '.title' => array('value' => '[term:name]'), + $prefix . '.identifier' => array('value' => '[site:url]/taxonomy/term/[term:tid]'), + $prefix . '.description' => array('value' => '[term:description]'), ); break; + case 'user': $config->config += array( - 'dc.title' => array('value' => '[user:name]'), + $prefix . '.title' => array('value' => '[user:name]'), + $prefix . '.date' => array('value' => '[user:created:custom:Y-m-d\TH:iP]'), + $prefix . '.identifier' => array('value' => '[site:url]/user/[user:uid]'), + $prefix . '.creator' => array('value' => '[user:name]'), ); break; } @@ -57,150 +63,203 @@ function wetkit_metatag_metatag_config_default_alter(array &$configs) { /** * Implements hook_metatag_info(). + * Dublin Core Elements taken from http://purl.org/dc/elements/1.1/. */ function wetkit_metatag_metatag_info() { - $info['groups']['wetkit-metadata'] = array( - 'label' => t('WetKit Metadata'), + $prefix = _metadata_dc_prefix(); + $info['groups']['dublin-core'] = array( + 'label' => t('Dublin Core'), + 'description' => t('Dublin Core 15 basic metadata fields'), + 'form' => array( + '#weight' => 95, + ), ); - $info['tags']['tmp.title'] = array( - 'label' => t('WetKit Metadata title'), - 'description' => t('The main title of your object as it should appear within the display.'), + $info['tags'][$prefix . '.title'] = array( + 'label' => t('Dublin Core Title'), + 'description' => t('The name given to the resource.'), 'class' => 'DrupalTextMetaTag', - 'group' => 'wetkit-metadata', + 'group' => 'dublin-core', 'element' => array( - '#theme' => 'wetkit_metatag_title', + '#type' => 'term', + '#theme' => 'wetkit_metatag', ), ); - $info['tags']['dc.title'] = array( - 'label' => t('WetKit Metadata title'), - 'description' => t('The title of your object as it should appear within the display.'), + $info['tags'][$prefix . '.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', - 'group' => 'wetkit-metadata', 'element' => array( '#theme' => 'wetkit_metatag', ), ); - $info['tags']['dc.site_name'] = array( - 'label' => t('WetKit Metadata site name'), - 'description' => t('A human-readable name for your site, e.g., Web Experience Toolkit.'), + $info['tags'][$prefix . '.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', - 'group' => 'wetkit-metadata', - 'context' => array('global'), + 'group' => 'dublin-core', 'element' => array( '#theme' => 'wetkit_metatag', ), ); - $info['tags']['dc.url'] = array( - 'label' => t('WetKit Metadata URL'), - 'description' => t('The canonical URL of your object that will be used as its permanent ID in the website.'), + $info['tags'][$prefix . '.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', - 'group' => 'wetkit-metadata', 'element' => array( '#theme' => 'wetkit_metatag', ), ); - $info['tags']['dc.language'] = array( - 'label' => t('WetKit Metadata Language'), - 'description' => t('The language of your object'), + $info['tags'][$prefix . '.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', - 'group' => 'wetkit-metadata', 'element' => array( - '#theme' => 'wetkit_metatag_language', + '#theme' => 'wetkit_metatag', ), ); - $info['tags']['dc.creator'] = array( - 'label' => t('WetKit Metadata Creator'), - 'description' => t('The creator of the overall site content'), + $info['tags'][$prefix . '.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', - 'group' => 'wetkit-metadata', 'element' => array( '#theme' => 'wetkit_metatag', ), ); - $info['tags']['dc.description'] = array( - 'label' => t('WetKit Metadata description'), - 'description' => t('A one to two sentence description of your page.'), - 'group' => 'wetkit-metadata', + $info['tags'][$prefix . '.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', + 'group' => 'dublin-core', 'element' => array( '#theme' => 'wetkit_metatag', + '#schema' => 'W3CDTF', ), ); - $info['tags']['date'] = array( - 'label' => t('WetKit Metadata date'), - 'description' => t('The date of your object as it was most recently changed.'), + $info['tags'][$prefix . '.issued'] = array( + 'label' => t('Dublin Core Issued 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', - 'group' => 'wetkit-metadata', + 'group' => 'dublin-core', 'element' => array( '#theme' => 'wetkit_metatag', + '#schema' => 'W3CDTF', ), ); - $info['tags']['dcterms.issued'] = array( - 'label' => t('WetKit Metadata Date Created'), - 'description' => t('The date of your object as it was created.'), + $info['tags'][$prefix . '.modified'] = array( + 'label' => t('Dublin Core Modified 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', - 'group' => 'wetkit-metadata', + 'group' => 'dublin-core', 'element' => array( - '#theme' => 'wetkit_metatag_scheme', + '#theme' => 'wetkit_metatag', + '#schema' => 'W3CDTF', ), ); - $info['tags']['dcterms.modified'] = array( - 'label' => t('WetKit Metadata Date Modified'), - 'description' => t('The date of your object as it was modified.'), + $info['tags'][$prefix . '.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', - 'group' => 'wetkit-metadata', + 'group' => 'dublin-core', + 'form' => array( + '#type' => 'select', + '#options' => _wetkit_metatag_dcmi_type_vocabulary_options(), + '#empty_option' => t('- None -'), + ), 'element' => array( - '#theme' => 'wetkit_metatag_scheme', + '#theme' => 'wetkit_metatag', + '#schema' => 'DCTERMS.DCMIType', ), ); - $info['tags']['author'] = array( - 'label' => t('WetKit Metadata Author'), - 'description' => t('The main Author of the page.'), + $info['tags'][$prefix . '.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', - 'group' => 'wetkit-metadata', + 'group' => 'dublin-core', 'element' => array( '#theme' => 'wetkit_metatag', + '#schema' => 'DCTERMS.IMT', ), ); - $info['tags']['dc.type'] = array( - 'label' => t('WetKit Metadata type'), - 'description' => t('The type of your object, for example:, Graph.'), + $info['tags'][$prefix . '.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', - 'group' => 'wetkit-metadata', - 'form' => array( - '#type' => 'select', - '#options' => _wetkit_metatag_type_options(), - '#empty_option' => t('- None -'), + 'group' => 'dublin-core', + 'element' => array( + '#theme' => 'wetkit_metatag', + ), + ); + $info['tags'][$prefix . '.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' => 'wetkit_metatag', ), + ); + $info['tags'][$prefix . '.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', + 'group' => 'dublin-core', + 'element' => array( + '#theme' => 'wetkit_metatag', + ), + ); + $info['tags'][$prefix . '.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' => 'wetkit_metatag', ), ); - $info['tags']['dc.image'] = array( - 'label' => t('WetKit Metadata image'), - 'description' => t('An image URL which should represent your object within the page. (PNG, JPEG and GIF formats)'), + $info['tags'][$prefix . '.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', - 'group' => 'wetkit-metadata', 'element' => array( '#theme' => 'wetkit_metatag', ), ); + $info['tags'][$prefix . '.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' => 'wetkit_metatag', + ), + ); + return $info; } -function _wetkit_metatag_type_options() { +/** + * Function that returns the DCMI type options. + * Types taken from http://dublincore.org/documents/dcmi-type-vocabulary/. + */ +function _wetkit_metatag_dcmi_type_vocabulary_options() { $options = array( - t('Graph') => array( - 'bar' => t('bar'), - 'line' => t('line'), - ), - t('Media') => array( - 'image' => t('Image'), - 'video' => t('Video'), - 'diagram' => t('Diagram'), - 'audio' => t('Audio'), - 'text' => t('Text'), - ), + 'Collection', + 'Dataset', + 'Event', + 'Image', + 'InteractiveResource', + 'MovingImage', + 'PhysicalObject', + 'Service', + 'Software', + 'Sound', + 'StillImage', + 'Text', ); - return $options; + return drupal_map_assoc($options); } diff --git a/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.module b/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.module index 9e1b221d..1632cccd 100644 --- a/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.module +++ b/modules/apps/wetkit_web_usability/wetkit_metatag/wetkit_metatag.module @@ -1,14 +1,51 @@ 1); - } +function wetkit_metatag_menu() { + $items = array(); + + // Setup a local task to configure Dublin Core. + $items['admin/config/search/metatags/dublin-core'] = array( + 'title' => 'Dublin Core', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'drupal_get_form', + 'page arguments' => array('wetkit_metatag_config'), + 'access arguments' => array('administer meta tags'), + 'weight' => 1, + 'file' => 'wetkit_metatag.admin.inc', + ); + + return $items; } +/** + * Implements hook_page_build. + */ +function wetkit_metatag_page_build(&$page) { + // When the HTML5 is standardize we can then update and display + /* + $attributes = array( + 'rel' => 'schema.DC', + 'href' => 'http://purl.org/dc/elements/1.1/', + ); + drupal_add_html_head_link($attributes); + $attributes = array( + 'rel' => 'schema.DCTERMS', + 'href' => 'http://purl.org/dc/terms/', + ); + drupal_add_html_head_link($attributes); + */ +} + +/** + * Implements hook_form_alter. + */ function wetkit_metatag_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'wetkit_page_node_form' || $form_id == 'wetkit_page_other_node_form') { $form['metatags_advanced'] = $form['metatags']['advanced']; @@ -29,6 +66,15 @@ function wetkit_metatag_form_alter(&$form, &$form_state, $form_id) { unset($form['metatags']['wetkit-metadata']); } +/** + * Implements hook_ctools_plugin_api(). + */ +function wetkit_metatag_ctools_plugin_api($owner, $api) { + if ($owner == 'metatag' && $api == 'metatag') { + return array('version' => 1); + } +} + /** * Implements hook_theme(). */ @@ -36,72 +82,46 @@ function wetkit_metatag_theme() { $info['wetkit_metatag'] = array( 'render element' => 'element', ); - $info['wetkit_metatag_scheme'] = array( - 'render element' => 'element', - ); - $info['wetkit_metatag_language'] = array( - 'render element' => 'element', - ); - $info['wetkit_metatag_title'] = array( - 'render element' => 'element', - ); + return $info; } /** - * Theme callback for an WetKit meta tag. + * Theme callback for a Dublin Core meta tag. */ function theme_wetkit_metatag($variables) { $element = &$variables['element']; - element_set_attributes($element, array('#name' => 'name', '#value' => 'content')); - unset($element['#value']); - return theme('html_tag', $variables); -} - -/** - * Theme callback for an WetKit meta tag. - */ -function theme_wetkit_metatag_scheme($variables) { - $element = &$variables['element']; - element_set_attributes($element, array('#name' => 'name', '#value' => 'content')); - $element['#attributes']['scheme'] = 'W3CDTF'; - unset($element['#value']); - return theme('html_tag', $variables); -} - -/** - * Theme callback for an WetKit meta tag (language). - */ -function theme_wetkit_metatag_language($variables) { - $element = &$variables['element']; - element_set_attributes($element, array('#name' => 'name', '#value' => 'content')); - $element['#attributes']['scheme'] = 'ISO639-2/T'; - unset($element['#value']); - return theme('html_tag', $variables); -} - -/** - * Theme callback for an WetKit meta tag. - */ -function theme_wetkit_metatag_title($variables) { - $element = &$variables['element']; - element_set_attributes($element, array('#name' => 'name', '#value' => 'content')); - $element['#attributes']['name'] = 'title'; + element_set_attributes($element, array( + '#name' => 'name', + '#schema' => 'title', + '#value' => 'content') + ); unset($element['#value']); return theme('html_tag', $variables); } /** - * Get Current Language of User Interface + * Get the Dublin Core prefix. */ -function wetkit_current_lang() { - global $language; - if ($language->name == 'French') { - $val_lang = "fra"; - } - else { - $val_lang = "eng"; - } - return $val_lang; +function _metadata_dc_prefix() { + return variable_get('wetkit_metatag_prefix', 'dcterms'); } +/* +Dublin Core Basic Elements (15) +dc:title +dc:creator +dc:subject +dc:description +dc:publisher +dc:contributor +dc:date +dc:type +dc:format +dc:identifier +dc:source +dc:language +dc:relation +dc:coverage +dc:rights +*/ diff --git a/modules/apps/wetkit_web_usability/wetkit_web_usability.info b/modules/apps/wetkit_web_usability/wetkit_web_usability.info index 1d1419de..7ffd63dd 100644 --- a/modules/apps/wetkit_web_usability/wetkit_web_usability.info +++ b/modules/apps/wetkit_web_usability/wetkit_web_usability.info @@ -19,7 +19,7 @@ dependencies[] = search dependencies[] = strongarm dependencies[] = views dependencies[] = wetkit_box -;dependencies[] = wetkit_metatag +dependencies[] = wetkit_metatag dependencies[] = wetkit_security apps[server][] = local apps[manifests][] = app/manifest.app