metatag_twitter_cards.install 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * @file
  4. * Update scripts for the Metatag: Twitter Cards module.
  5. */
  6. /**
  7. * Implements hook_update_dependencies().
  8. */
  9. function metatag_twitter_cards_update_dependencies() {
  10. // Twitter Cards update 7100 requires the complete Metatag schema, so lets
  11. // wait for Metatag update 7100 just to be sure.
  12. $dependencies['metatag_twitter_cards'][7100] = array(
  13. 'metatag' => 7100,
  14. );
  15. return $dependencies;
  16. }
  17. /**
  18. * Implements hook_uninstall().
  19. */
  20. function metatag_twitter_cards_uninstall() {
  21. // Remove all of the maxlength variables.
  22. variable_del('metatag_maxlength_twitter:title');
  23. variable_del('metatag_maxlength_twitter:description');
  24. }
  25. /**
  26. * Implementations of hook_update_N().
  27. */
  28. /**
  29. * Rename the 'twitter:image:src' meta tag back to 'twitter:image'. Sorry.
  30. */
  31. function metatag_twitter_cards_update_7100(&$sandbox) {
  32. module_load_include('install', 'metatag');
  33. $old_tag = 'twitter:image:src';
  34. $new_tag = 'twitter:image';
  35. return metatag_update_replace_entity_tag($sandbox, $old_tag, $new_tag);
  36. }
  37. /**
  38. * Rename the 'twitter:image:src' meta tag back to 'twitter:image', part 2.
  39. */
  40. function metatag_twitter_cards_update_7101() {
  41. module_load_include('install', 'metatag');
  42. $old_tag = 'twitter:image:src';
  43. $new_tag = 'twitter:image';
  44. return metatag_update_replace_config_tag($old_tag, $new_tag);
  45. }
  46. /**
  47. * Clear the Metatag cache.
  48. */
  49. function metatag_twitter_cards_update_7102() {
  50. cache_clear_all('*', 'cache_metatag', TRUE);
  51. return t('All Metatag caches cleared.');
  52. }