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