| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: user_name.inc,v 1.1.2.2 2010/01/29 20:18:25 merlinofchaos Exp $ 3 4 /** 5 * @file 6 * 7 * Plugin to provide an argument handler for a username 8 */ 9 10 /** 11 * Plugins are described by creating a $plugin array which will be used 12 * by the system that includes this file. 13 */ 14 $plugin = array( 15 'title' => t("User: name"), 16 // keyword to use for %substitution 17 'keyword' => 'user', 18 'description' => t('Creates a user context from a user name.'), 19 'context' => 'ctools_argument_user_name_context', 20 'placeholder form' => array( 21 '#type' => 'textfield', 22 '#description' => t('Enter the username of a user for this argument'), 23 ), 24 ); 25 26 /** 27 * Discover if this argument gives us the user we crave. 28 */ 29 function ctools_argument_user_name_context($arg = NULL, $conf = NULL, $empty = FALSE) { 30 // If unset it wants a generic, unfilled context. 31 if ($empty) { 32 return ctools_context_create_empty('user'); 33 } 34 35 // We can accept either a node object or a pure nid. 36 if (is_object($arg)) { 37 return ctools_context_create('user', $arg); 38 } 39 40 $account = user_load(array('name' => $arg)); 41 if (!$account) { 42 return NULL; 43 } 44 return ctools_context_create('user', $account); 45 } 46 47 48
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |