Projet

Général

Profil

Paste
Télécharger (1,76 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / plugins / content_types / contact / user_contact.inc @ 651307cd

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('User contact form'),
11
    'icon' => 'icon_contact.png',
12
    'description' => t('The site contact form that allows users to contact other users.'),
13
    'category' => t('User'),
14
    'required context' => new ctools_context_required(t('User'), 'user'),
15
  );
16
}
17

    
18
/**
19
 * Render the custom content type.
20
 */
21
function ctools_user_contact_content_type_render($subtype, $conf, $panel_args, $context) {
22
  if (empty($context) || empty($context->data)) {
23
    return;
24
  }
25

    
26
  if (!_contact_personal_tab_access($context->data)) {
27
    return;
28
  }
29

    
30
  // Build the content type block.
31
  $block = new stdClass();
32
  $block->module  = 'contact';
33
  $block->delta   = 'form';
34
  $block->title   = t('Contact @name', array('@name' => $context->data->name));
35

    
36
  module_load_include('inc', 'contact', 'contact.pages');
37
  $block->content = drupal_get_form('contact_personal_form', $context->data);
38
  return $block;
39
}
40

    
41
/**
42
 * Returns an edit form for custom type settings.
43
 */
44
function ctools_user_contact_content_type_edit_form($form, &$form_state) {
45
  // Empty so that we can have title override.
46
  return $form;
47
}
48

    
49
/**
50
 * Submit handler for contact form.
51
 */
52
function ctools_user_contact_content_type_edit_form_submit(&$form, &$form_state) {
53
  // Copy everything from our defaults.
54
/*
55
  foreach (array_keys($form_state['plugin']['defaults']) as $key) {
56
    $form_state['conf'][$key] = $form_state['values'][$key];
57
  }
58
*/
59
}
60

    
61
/**
62
 * Returns the administrative title for a type.
63
 */
64
function ctools_user_contact_content_type_admin_title($subtype, $conf, $context) {
65
  return t('User contact form');
66
}