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