summaryrefslogtreecommitdiff
path: root/sites/all/modules/ctools/plugins/content_types/contact/contact.inc
blob: 63283f598d46d1b9f90b16461e0763f93c6347c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php

if (module_exists('contact')) {
  /**
   * Plugins are described by creating a $plugin array which will be used
   * by the system that includes this file.
   */
  $plugin = array(
    'single' => TRUE,
    'title' => t('Contact form'),
    'icon' => 'icon_contact.png',
    'description' => t('The site contact form that allows users to send a message to site administrators.'),
    'category' => t('Widgets'),
  );
}

/**
 * Render the custom content type.
 */
function ctools_contact_content_type_render($subtype, $conf, $panel_args, $context) {
  if (!user_access('access site-wide contact form')) {
    return;
  }
  // Build the content type block.
  $block = new stdClass();
  $block->module  = 'contact';
  $block->delta   = 'form';
  $block->title   = t('Contact');

  module_load_include('inc', 'contact', 'contact.pages');
  $block->content = drupal_get_form('contact_site_form');
  return $block;
}

/**
 * Returns an edit form for custom type settings.
 */
function ctools_contact_content_type_edit_form($form, &$form_state) {
  // Empty so that we can have title override.
  return $form;
}

/**
 * Submit handler for contact form.
 */
function ctools_contact_content_type_edit_form_submit($form, &$form_state) {
  // Copy everything from our defaults.
/*
  foreach (array_keys($form_state['plugin']['defaults']) as $key) {
    $form_state['conf'][$key] = $form_state['values'][$key];
  }
*/
}

/**
 * Returns the administrative title for a type.
 */
function ctools_contact_content_type_admin_title($subtype, $conf, $context) {
  return t('Contact form');
}