12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- /**
- * @file
- * Primary hook implementations for Metatag: Google+.
- */
- /**
- * Implements hook_ctools_plugin_api().
- */
- function metatag_google_plus_ctools_plugin_api($owner, $api) {
- if ($owner == 'metatag' && $api == 'metatag') {
- return array('version' => 1);
- }
- }
- /**
- * Implements hook_theme().
- */
- function metatag_google_plus_theme() {
- $info['metatag_google_plus'] = array(
- 'render element' => 'element',
- );
- return $info;
- }
- /**
- * Theme callback for an Google+ meta tag.
- *
- * The format is:
- * <meta itemprop="[itemprop]" content="[value]" />
- */
- function theme_metatag_google_plus($variables) {
- $element = &$variables['element'];
- // The format is e.g. 'itemprop:name'. Remove 'itemprop:' and store the rest
- // in '#itemprop'.
- $element['#itemprop'] = substr($element['#name'], 9);
- $args = array(
- '#itemprop' => 'itemprop',
- '#value' => 'content',
- );
- element_set_attributes($element, $args);
- unset($element['#value']);
- return theme('html_tag', $variables);
- }
- /**
- * Implements hook_preprocess_html().
- *
- * Add itemtype when available.
- *
- * Note: The $schemaorg variable must be added to the html tag of the
- * html.tpl.php template after the $rdf_namespaces variable, see README.txt
- * for details.
- */
- function metatag_google_plus_preprocess_html(&$variables) {
- if (!isset($variables['schemaorg'])) {
- $variables['schemaorg'] = '';
- }
- if (isset($variables['itemtype']) && !function_exists('zen_preprocess_html')) {
- $variables['schemaorg'] .= " itemscope itemtype=\"http://schema.org/{$variables['itemtype']}\"";
- }
- }
|