/[drupal]/contributions/modules/views/plugins/views_plugin_argument_validate.inc
ViewVC logotype

Contents of /contributions/modules/views/plugins/views_plugin_argument_validate.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Mon Jun 1 23:34:55 2009 UTC (5 months, 3 weeks ago) by merlinofchaos
Branch: MAIN
CVS Tags: DRUPAL-6--2-7, DRUPAL-6--2-6, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-7--3
Changes since 1.1: +14 -1 lines
File MIME type: text/x-php
#428192 by dereine: Move comments to their correct files.
1 <?php
2 // $Id: views_plugin_argument_validate.inc,v 1.1 2008/09/03 19:21:30 merlinofchaos Exp $
3 /**
4 * @file
5 * Contains the base argument validator plugin.
6 */
7
8 /**
9 * @defgroup views_argument_validate_plugins Views' argument validate plugins
10 * @{
11 *
12 * Allow specialized methods of validating arguments.
13 *
14 * @see hook_views_plugins
15 */
16
17 /**
18 * Base argument validator plugin to provide basic functionality.
19 *
20 * @ingroup views_argument_validate_plugins
21 */
22 class views_plugin_argument_validate extends views_plugin {
23 var $option_name = 'validate_argument';
24
25 /**
26 * Initialize this plugin with the view and the argument
27 * it is linked to.
28 */
29 function init(&$view, &$argument, $id = NULL) {
30 $this->view = &$view;
31 $this->argument = &$argument;
32 $this->id = $id;
33 }
34
35 /**
36 * Determine if the administrator has the privileges to use this
37 * plugin
38 */
39 function access() { return TRUE; }
40
41 function argument_form(&$form, &$form_state) {
42 }
43
44 /**
45 * If we don't have access to the form but are showing it anyway, ensure that
46 * the form is safe and cannot be changed from user input.
47 */
48 function check_access(&$form) {
49 if (!$this->access()) {
50 $form[$this->option_name]['#disabled'] = TRUE;
51 $form[$this->option_name]['#value'] = $form[$this->option_name]['#default_value'];
52 $form[$this->option_name]['#description'] .= ' <strong>' . t('Note: you do not have permission to modify this. If you change the validator, this setting will be lost and you will NOT be able to get it back.') . '</strong>';
53 }
54 }
55
56 /**
57 * Return the validate argument.
58 */
59 function get_argument() {
60 return isset($this->argument->options[$this->option_name]) ? $this->argument->options[$this->option_name] : '';
61 }
62
63 function validate_form(&$form, &$form_state) { }
64
65 function validate_argument($arg) { return TRUE; }
66 }
67
68 /**
69 * @}
70 */
71

  ViewVC Help
Powered by ViewVC 1.1.2