| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @file 4 * Contains the fixed argument default plugin. 5 */ 6 7 /** 8 * @defgroup views_argument_default_plugins Views' argument default plugins 9 * @{ 10 * 11 * Allow specialized methods of filling in arguments when they aren't 12 * provided. 13 * 14 * @see hook_views_plugins 15 */ 16 17 /** 18 * The fixed argument default handler; also used as the base. 19 */ 20 class views_plugin_argument_default extends views_plugin { 21 var $option_name = 'default_argument_fixed'; 22 /** 23 * Initialize this plugin with the view and the argument 24 * it is linked to. 25 */ 26 function init(&$view, &$argument, $id = NULL) { 27 $this->view = &$view; 28 $this->argument = &$argument; 29 $this->id = $id; 30 } 31 32 /** 33 * Determine if the administrator has the privileges to use this 34 * plugin 35 */ 36 function access() { return TRUE; } 37 38 function argument_form(&$form, &$form_state) { 39 $form[$this->option_name] = array( 40 '#type' => 'textfield', 41 '#title' => t('Default argument'), 42 '#default_value' => $this->get_argument(), 43 '#process' => array('views_process_dependency'), 44 '#dependency' => array( 45 'radio:options[default_action]' => array('default'), 46 'radio:options[default_argument_type]' => array($this->id) 47 ), 48 '#dependency_count' => 2, 49 ); 50 51 // Only do this if using one simple standard form gadget 52 $this->check_access($form); 53 } 54 55 /** 56 * If we don't have access to the form but are showing it anyway, ensure that 57 * the form is safe and cannot be changed from user input. 58 */ 59 function check_access(&$form) { 60 if (!$this->access()) { 61 $form[$this->option_name]['#disabled'] = TRUE; 62 $form[$this->option_name]['#value'] = $form[$this->option_name]['#default_value']; 63 $form[$this->option_name]['#description'] .= ' <strong>' . t('Note: you do not have permission to modify this. If you change the default argument type, this setting will be lost and you will NOT be able to get it back.') . '</strong>'; 64 } 65 } 66 67 /** 68 * Return the default argument. 69 */ 70 function get_argument() { 71 return isset($this->argument->options[$this->option_name]) ? $this->argument->options[$this->option_name] : ''; 72 } 73 } 74 75 /** 76 * @} 77 */ 78
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 |