metatag.variable.inc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * @file
  4. * Definition of variables for Variable API module.
  5. */
  6. /**
  7. * Implements hook_variable_info().
  8. */
  9. function metatag_variable_info($options) {
  10. $variables['metatag_pager_string'] = array(
  11. 'title' => t('Custom pager string', array(), $options),
  12. 'type' => 'string',
  13. 'description' => t('When the current page includes a pager, e.g. the URL contains "?page=42", the [current-page:pager] token may be added to a meta tag to differentiate between two pages that would otherwise have the same meta tags. The value "PAGER" (must be in uppercase) will be replaced by the actual page count. Note: the pager will only output if the page number is 2 or above and the string "page=NUMBER" is in the URL.<br />For best use, it may be worthwhile to add the [current-page:pager] to the page title to the left of the site name, to the start of description tags, etc.', array(), $options),
  14. 'default' => 'Page PAGER | ',
  15. 'group' => 'metatag',
  16. 'localize' => TRUE,
  17. 'multidomain' => TRUE,
  18. );
  19. $info = metatag_get_info();
  20. $groups = $info['groups'];
  21. $tags = $info['tags'];
  22. foreach ($tags as $tag => $info) {
  23. if (isset($info['maxlength'])) {
  24. $default = $info['maxlength'];
  25. $var_name = 'metatag_maxlength_' . $tag;
  26. $title = $info['label'];
  27. if (!empty($info['group']) && isset($groups[$info['group']])) {
  28. $title = $groups[$info['group']]['label'] . ': ' . $title;
  29. }
  30. $variables[$var_name] = array(
  31. 'title' => t('Maximum length for @tag', array('@tag' => $title), $options),
  32. 'type' => 'string',
  33. 'description' => t('Controls the maximum length of the @tag meta tag, values longer than this will be truncated. If set to "0" the maximum length will be ignored.', array('@tag' => $title), $options),
  34. 'default' => intval(variable_get($var_name, $default)),
  35. 'group' => 'metatag',
  36. 'localize' => TRUE,
  37. 'multidomain' => TRUE,
  38. );
  39. }
  40. }
  41. return $variables;
  42. }
  43. /**
  44. * Implements hook_variable_group_info().
  45. */
  46. function metatag_variable_group_info() {
  47. $groups['metatag'] = array(
  48. 'title' => t('Metatag'),
  49. 'description' => t('Configure meta tags on your website.'),
  50. 'access' => 'administer meta tags',
  51. 'path' => array('admin/config/search/metatags/settings'),
  52. );
  53. return $groups;
  54. }