| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @file 4 * Contains the php code argument default plugin. 5 */ 6 7 /** 8 * Default argument plugin to provide a PHP code block. 9 */ 10 class views_plugin_argument_default_php extends views_plugin_argument_default { 11 var $option_name = 'default_argument_php'; 12 13 function argument_form(&$form, &$form_state) { 14 $form[$this->option_name] = array( 15 '#type' => 'textarea', 16 '#title' => t('PHP argument code'), 17 '#default_value' => $this->get_argument(TRUE), // the true forces it raw. 18 '#process' => array('views_process_dependency'), 19 '#description' => t('Enter PHP code that returns a value to use for this argument. Do not use <?php ?>. You must return only a single value for just this argument.'), 20 '#dependency' => array( 21 'radio:options[default_action]' => array('default'), 22 'radio:options[default_argument_type]' => array($this->id) 23 ), 24 '#dependency_count' => 2, 25 ); 26 27 $this->check_access($form); 28 } 29 30 /** 31 * Only let users with PHP block visibility permissions set/modify this 32 * default plugin. 33 */ 34 function access() { 35 return user_access('use PHP for block visibility'); 36 } 37 38 function get_argument($raw = FALSE) { 39 if ($raw) { 40 return parent::get_argument(); 41 } 42 43 // set up variables to make it easier to reference during the argument. 44 $view = &$this->view; 45 $argument = &$this->argument; 46 ob_start(); 47 $result = eval($this->argument->options[$this->option_name]); 48 ob_end_clean(); 49 return $result; 50 } 51 }
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 |