contact.inc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * @file
  4. */
  5. if (module_exists('contact')) {
  6. /**
  7. * Plugins are described by creating a $plugin array which will be used
  8. * by the system that includes this file.
  9. */
  10. $plugin = array(
  11. 'single' => TRUE,
  12. 'title' => t('Contact form'),
  13. 'icon' => 'icon_contact.png',
  14. 'description' => t('The site contact form that allows users to send a message to site administrators.'),
  15. 'category' => t('Widgets'),
  16. );
  17. }
  18. /**
  19. * Render the custom content type.
  20. */
  21. function ctools_contact_content_type_render($subtype, $conf, $panel_args, $context) {
  22. if (!user_access('access site-wide contact form')) {
  23. return;
  24. }
  25. // Build the content type block.
  26. $block = new stdClass();
  27. $block->module = 'contact';
  28. $block->delta = 'form';
  29. $block->title = t('Contact');
  30. module_load_include('inc', 'contact', 'contact.pages');
  31. $block->content = drupal_get_form('contact_site_form');
  32. return $block;
  33. }
  34. /**
  35. * Returns an edit form for custom type settings.
  36. */
  37. function ctools_contact_content_type_edit_form($form, &$form_state) {
  38. // Empty so that we can have title override.
  39. return $form;
  40. }
  41. /**
  42. * Submit handler for contact form.
  43. */
  44. function ctools_contact_content_type_edit_form_submit($form, &$form_state) {
  45. // Copy everything from our defaults.
  46. }
  47. /**
  48. * Returns the administrative title for a type.
  49. */
  50. function ctools_contact_content_type_admin_title($subtype, $conf, $context) {
  51. return t('Contact form');
  52. }