| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: string.inc,v 1.3.2.3 2010/01/29 20:18:25 merlinofchaos Exp $ 3 4 /** 5 * @file 6 * 7 * Plugin to provide an argument handler for a raw string 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("String"), 15 // keyword to use for %substitution 16 'keyword' => 'string', 17 'description' => t('A string is a minimal context that simply holds a string that can be used for some other purpose.'), 18 'settings form' => 'ctools_string_settings_form', 19 'context' => 'ctools_string_context', 20 'placeholder form' => array( 21 '#type' => 'textfield', 22 '#description' => t('Enter a value for this argument'), 23 ), 24 'path placeholder' => 'ctools_string_path_placeholder', // This is in pagemanager. 25 ); 26 27 /** 28 * Discover if this argument gives us the term we crave. 29 */ 30 function ctools_string_context($arg = NULL, $conf = NULL, $empty = FALSE) { 31 // If unset it wants a generic, unfilled context. 32 if ($empty) { 33 return ctools_context_create_empty('string'); 34 } 35 36 $context = ctools_context_create('string', $arg); 37 $context->original_argument = $arg; 38 39 return $context; 40 } 41 42 /** 43 * Settings form for the argument 44 */ 45 function ctools_string_settings_form(&$form, &$form_state, $conf) { 46 $form['settings']['use_tail'] = array( 47 '#title' => t('Get all arguments after this one'), 48 '#type' => 'checkbox', 49 '#default_value' => !empty($conf['use_tail']), 50 '#description' => t('If checked, this string will include all arguments. For example, if the path is "path/%" and the user visits "path/foo/bar", if this is not checked the string will be "foo". If it is checked the string will be "foo/bar".'), 51 ); 52 } 53 54 /** 55 * Switch the placeholder based upon user settings. 56 */ 57 function ctools_string_path_placeholder($argument) { 58 if (empty($argument['settings']['use_tail'])) { 59 return '%pm_arg'; 60 } 61 else { 62 return '%pm_arg_tail'; 63 } 64 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |