contact_site.inc

  1. cis7 sites/all/modules/ulmus/ctools/page_manager/plugins/tasks/contact_site.inc
  2. cle7 sites/all/modules/ulmus/ctools/page_manager/plugins/tasks/contact_site.inc
  3. ecd7 sites/all/modules/ulmus/ctools/page_manager/plugins/tasks/contact_site.inc
  4. elmsmedia7 sites/all/modules/ulmus/ctools/page_manager/plugins/tasks/contact_site.inc
  5. harmony7 sites/all/modules/ulmus/ctools/page_manager/plugins/tasks/contact_site.inc
  6. icor7 sites/all/modules/ulmus/ctools/page_manager/plugins/tasks/contact_site.inc
  7. meedjum_blog7 sites/all/modules/ulmus/ctools/page_manager/plugins/tasks/contact_site.inc
  8. mooc7 sites/all/modules/ulmus/ctools/page_manager/plugins/tasks/contact_site.inc

Functions

Namesort descending Description
page_manager_contact_access_check Callback to determine if a page is accessible.
page_manager_contact_site Entry point for our overridden site contact.
page_manager_contact_site_enable Callback to enable/disable the page from the UI.
page_manager_contact_site_menu_alter Callback defined by page_manager_contact_site_page_manager_tasks().
page_manager_contact_site_page_manager_tasks Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for more information.

File

sites/all/modules/ulmus/ctools/page_manager/plugins/tasks/contact_site.inc
View source
  1. <?php
  2. /**
  3. * Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
  4. * more information.
  5. */
  6. function page_manager_contact_site_page_manager_tasks() {
  7. if (!module_exists('contact')) {
  8. return;
  9. }
  10. return array(
  11. // This is a 'page' task and will fall under the page admin UI
  12. 'task type' => 'page',
  13. 'title' => t('Site contact page'),
  14. 'admin title' => t('Site contact page'),
  15. 'admin description' => t('When enabled, this overrides the default Drupal behavior for the site contact page at <em>/contact</em>. If no variant is selected, the default Drupal contact form will be used.'),
  16. 'admin path' => 'contact',
  17. // Menu hooks so that we can alter the node/%node menu entry to point to us.
  18. 'hook menu alter' => 'page_manager_contact_site_menu_alter',
  19. // This is task uses 'context' handlers and must implement these to give the
  20. // handler data it needs.
  21. 'handler type' => 'context',
  22. // Allow this to be enabled or disabled:
  23. 'disabled' => variable_get('page_manager_contact_site_disabled', TRUE),
  24. 'enable callback' => 'page_manager_contact_site_enable',
  25. 'access callback' => 'page_manager_contact_access_check',
  26. );
  27. }
  28. /**
  29. * Callback defined by page_manager_contact_site_page_manager_tasks().
  30. *
  31. * Alter the node edit input so that node edit comes to us rather than the
  32. * normal node edit process.
  33. */
  34. function page_manager_contact_site_menu_alter(&$items, $task) {
  35. if (variable_get('page_manager_contact_site_disabled', TRUE)) {
  36. return;
  37. }
  38. $callback = $items['contact']['page callback'];
  39. if ($callback == 'drupal_get_form') {
  40. $callback = $items['contact']['page arguments'][0];
  41. }
  42. // Override the node edit handler for our purpose.
  43. if ($callback == 'contact_site_form' || variable_get('page_manager_override_anyway', FALSE)) {
  44. $items['contact']['page callback'] = 'page_manager_contact_site';
  45. $items['contact']['file path'] = $task['path'];
  46. $items['contact']['file'] = $task['file'];
  47. }
  48. else {
  49. variable_set('page_manager_contact_site_disabled', TRUE);
  50. if (!empty($GLOBALS['page_manager_enabling_contact_site'])) {
  51. drupal_set_message(t('Page manager module is unable to enable contact because some other module already has overridden with %callback.', array('%callback' => $callback)), 'warning');
  52. }
  53. return;
  54. }
  55. }
  56. /**
  57. * Entry point for our overridden site contact.
  58. *
  59. * This function asks its assigned handlers who, if anyone, would like
  60. * to run with it. If no one does, it passes through to Drupal core's
  61. * node edit, which is node_page_edit().
  62. */
  63. function page_manager_contact_site() {
  64. // Load my task plugin
  65. $task = page_manager_get_task('contact_site');
  66. ctools_include('context');
  67. ctools_include('context-task-handler');
  68. $output = ctools_context_handler_render($task, '', array(), array());
  69. if ($output !== FALSE) {
  70. return $output;
  71. }
  72. module_load_include('inc', 'contact', 'contact.pages');
  73. $function = 'contact_site_form';
  74. foreach (module_implements('page_manager_override') as $module) {
  75. $call = $module . '_page_manager_override';
  76. if (($rc = $call('contact_site')) && function_exists($rc)) {
  77. $function = $rc;
  78. break;
  79. }
  80. }
  81. // Otherwise, fall back.
  82. if ($function == 'contact_site_form') {
  83. return drupal_get_form($function);
  84. }
  85. return $function();
  86. }
  87. /**
  88. * Callback to enable/disable the page from the UI.
  89. */
  90. function page_manager_contact_site_enable($cache, $status) {
  91. variable_set('page_manager_contact_site_disabled', $status);
  92. // Set a global flag so that the menu routine knows it needs
  93. // to set a message if enabling cannot be done.
  94. if (!$status) {
  95. $GLOBALS['page_manager_enabling_contact_site'] = TRUE;
  96. }
  97. }
  98. /**
  99. * Callback to determine if a page is accessible.
  100. *
  101. * @param $task
  102. * The task plugin.
  103. * @param $subtask_id
  104. * The subtask id
  105. * @param $contexts
  106. * The contexts loaded for the task.
  107. * @return
  108. * TRUE if the current user can access the page.
  109. */
  110. function page_manager_contact_access_check($task, $subtask_id, $contexts) {
  111. return user_access('access site-wide contact form');
  112. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.