Projet

Général

Profil

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

root / drupal7 / sites / all / modules / ctools / plugins / arguments / user_edit.inc @ e4c061ad

1
<?php
2

    
3
/**
4
 * @file
5
 *
6
 * Plugin to provide an argument handler for a Taxonomy term
7
 */
8

    
9
/**
10
 * Plugins are described by creating a $plugin array which will be used
11
 * by the system that includes this file.
12
 */
13
$plugin = array(
14
  'title' => t("User edit form: User ID"),
15
  // keyword to use for %substitution
16
  'keyword' => 'user',
17
  'description' => t('Creates a user edit form context from a user ID argument.'),
18
  'context' => 'ctools_user_edit_context',
19
  'placeholder form' => array(
20
    '#type' => 'textfield',
21
    '#description' => t('Enter the user ID for this argument.'),
22
  ),
23
);
24

    
25
/**
26
 * Discover if this argument gives us the term we crave.
27
 */
28
function ctools_user_edit_context($arg = NULL, $conf = NULL, $empty = FALSE) {
29
  // If unset it wants a generic, unfilled context.
30
  if ($empty) {
31
    return ctools_context_create_empty('user_edit_form');
32
  }
33
  if(is_object($arg)){
34
    return ctools_context_create('user_edit_form', $arg);
35
  }
36
  if (!is_numeric($arg)) {
37
    return FALSE;
38
  }
39

    
40
  $account= user_load($arg);
41
  if (!$account) {
42
    return NULL;
43
  }
44

    
45
  // This will perform a node_access check, so we don't have to.
46
  return ctools_context_create('user_edit_form', $account);
47
}