contact.inc 1.5 KB

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