1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* Plugins are described by creating a $plugin array which will be used
|
5
|
* by the system that includes this file.
|
6
|
*/
|
7
|
$plugin = array(
|
8
|
'single' => TRUE,
|
9
|
'icon' => 'icon_user_form.png',
|
10
|
'title' => t('User form email field'),
|
11
|
'description' => t('The user email form.'),
|
12
|
'required context' => new ctools_context_required(t('Form'), 'form'),
|
13
|
'category' => t('Form'),
|
14
|
);
|
15
|
|
16
|
/**
|
17
|
* Ctools plugin content type render for the email form field.
|
18
|
*/
|
19
|
function ctools_user_form_email_content_type_render($subtype, $conf, $panel_args, &$context) {
|
20
|
$block = new stdClass();
|
21
|
$block->module = t('user-form');
|
22
|
|
23
|
$block->delta = 'title-options';
|
24
|
|
25
|
if (isset($context->form)) {
|
26
|
// The current password is required to change the email.
|
27
|
if (!empty($context->form['account']['current_pass'])) {
|
28
|
$block->content['current_pass'] = $context->form['account']['current_pass'];
|
29
|
unset($context->form['account']['current_pass']);
|
30
|
}
|
31
|
if (!empty($context->form['account']['mail'])) {
|
32
|
$block->content['mail'] = $context->form['account']['mail'];
|
33
|
unset($context->form['account']['mail']);
|
34
|
}
|
35
|
}
|
36
|
else {
|
37
|
$block->content = t('User email form.');
|
38
|
}
|
39
|
return $block;
|
40
|
}
|
41
|
|
42
|
/**
|
43
|
* Ctools plugin admin title function for the email form field.
|
44
|
*/
|
45
|
function ctools_user_form_email_content_type_admin_title($subtype, $conf, $context) {
|
46
|
return t('"@s" user form email field', array('@s' => $context->identifier));
|
47
|
}
|
48
|
|
49
|
/**
|
50
|
* Ctools plugin configuration edit form for the email form field.
|
51
|
*
|
52
|
* Provide a blank form so we have a place to have context setting.
|
53
|
*/
|
54
|
function ctools_user_form_email_content_type_edit_form($form, &$form_state) {
|
55
|
return $form;
|
56
|
}
|