date_views.install 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the Date Views module.
  5. */
  6. /**
  7. * Implements hook_install().
  8. */
  9. function date_views_install() {
  10. variable_set('date_views_month_format_with_year', 'F Y');
  11. variable_set('date_views_month_format_without_year', 'F');
  12. variable_set('date_views_day_format_with_year', 'l, F j, Y');
  13. variable_set('date_views_day_format_without_year', 'l, F j');
  14. variable_set('date_views_week_format_with_year', 'F j, Y');
  15. variable_set('date_views_week_format_without_year', 'F j');
  16. }
  17. /**
  18. * Implements hook_uninstall().
  19. */
  20. function date_views_uninstall() {
  21. variable_del('date_views_month_format_with_year');
  22. variable_del('date_views_month_format_without_year');
  23. variable_del('date_views_day_format_with_year');
  24. variable_del('date_views_day_format_without_year');
  25. variable_del('date_views_week_format_with_year');
  26. variable_del('date_views_week_format_without_year');
  27. }
  28. /**
  29. * Set default date views variables.
  30. */
  31. function date_views_update_7200() {
  32. if (!variable_get('date_views_month_format_with_year', FALSE)) {
  33. variable_set('date_views_month_format_with_year', 'F Y');
  34. }
  35. if (!variable_get('date_views_month_format_without_year', FALSE)) {
  36. variable_set('date_views_month_format_without_year', 'F');
  37. }
  38. if (!variable_get('date_views_day_format_with_year', FALSE)) {
  39. variable_set('date_views_day_format_with_year', 'l, F j, Y');
  40. }
  41. if (!variable_get('date_views_day_format_without_year', FALSE)) {
  42. variable_set('date_views_day_format_without_year', 'l, F j');
  43. }
  44. if (!variable_get('date_views_week_format_with_year', FALSE)) {
  45. variable_set('date_views_week_format_with_year', 'F j, Y');
  46. }
  47. if (!variable_get('date_views_week_format_without_year', FALSE)) {
  48. variable_set('date_views_week_format_without_year', 'F j');
  49. }
  50. }