user_contact.inc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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('User contact form'),
  13. 'icon' => 'icon_contact.png',
  14. 'description' => t('The site contact form that allows users to contact other users.'),
  15. 'category' => t('User'),
  16. 'required context' => new ctools_context_required(t('User'), 'user'),
  17. );
  18. }
  19. /**
  20. * Render the custom content type.
  21. */
  22. function ctools_user_contact_content_type_render($subtype, $conf, $panel_args, $context) {
  23. if (empty($context) || empty($context->data)) {
  24. return;
  25. }
  26. if (!_contact_personal_tab_access($context->data)) {
  27. return;
  28. }
  29. // Build the content type block.
  30. $block = new stdClass();
  31. $block->module = 'contact';
  32. $block->delta = 'form';
  33. $block->title = t('Contact @name', array('@name' => $context->data->name));
  34. module_load_include('inc', 'contact', 'contact.pages');
  35. $block->content = drupal_get_form('contact_personal_form', $context->data);
  36. return $block;
  37. }
  38. /**
  39. * Returns an edit form for custom type settings.
  40. */
  41. function ctools_user_contact_content_type_edit_form($form, &$form_state) {
  42. // Empty so that we can have title override.
  43. return $form;
  44. }
  45. /**
  46. * Submit handler for contact form.
  47. */
  48. function ctools_user_contact_content_type_edit_form_submit(&$form, &$form_state) {
  49. // Copy everything from our defaults.
  50. }
  51. /**
  52. * Returns the administrative title for a type.
  53. */
  54. function ctools_user_contact_content_type_admin_title($subtype, $conf, $context) {
  55. return t('User contact form');
  56. }