Projet

Général

Profil

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

root / drupal7 / sites / all / modules / ctools / plugins / content_types / user_form / user_form_password.inc @ 6e3ce7c2

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 password field'),
11
  'description' => t('The user password 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 password form field.
18
 */
19
function ctools_user_form_password_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 password.
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']['pass'])) {
32
      $block->content['pass'] = $context->form['account']['pass'];
33
      unset($context->form['account']['pass']);
34
    }
35
  }
36
  else {
37
    $block->content = t('User password form.');
38
  }
39
  return $block;
40
}
41

    
42
/**
43
 * Ctools plugin admin title function for the password form field.
44
 */
45
function ctools_user_form_password_content_type_admin_title($subtype, $conf, $context) {
46
  return t('"@s" user form password field', array('@s' => $context->identifier));
47
}
48

    
49
/**
50
 * Ctools plugin configuration edit form for the password form field.
51
 *
52
 * Provide a blank form so we have a place to have context setting.
53
 */
54
function ctools_user_form_password_content_type_edit_form($form, &$form_state) {
55
  return $form;
56
}