Projet

Général

Profil

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

root / drupal7 / sites / all / modules / ctools / plugins / content_types / user_form / user_form_roles.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 roles field'),
11
  'description' => t('The user roles 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 roles form field.
18
 */
19
function ctools_user_form_roles_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
    if (!empty($context->form['account']['roles'])) {
27
      $block->content['roles'] = $context->form['account']['roles'];
28
      unset($context->form['account']['roles']);
29
    }
30
  }
31
  else {
32
    $block->content = t('User roles form.');
33
  }
34
  return $block;
35
}
36

    
37
/**
38
 * Ctools plugin admin title function for the roles form field.
39
 */
40
function ctools_user_form_roles_content_type_admin_title($subtype, $conf, $context) {
41
  return t('"@s" user form roles field', array('@s' => $context->identifier));
42
}
43

    
44
/**
45
 * Ctools plugin configuration edit form for the roles form field.
46
 *
47
 * Provide a blank form so we have a place to have context setting.
48
 */
49
function ctools_user_form_roles_content_type_edit_form($form, &$form_state) {
50
  return $form;
51
}