source: sipes/modules_contrib/views/plugins/views_plugin_argument_validate.inc @ 177a560

stableversion-3.0
Last change on this file since 177a560 was 177a560, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agrego el directorio de modulos contribuidos de drupal

  • Propiedad mode establecida a 100644
File size: 1.8 KB
Línea 
1<?php
2/**
3 * @file
4 * Contains the base argument validator plugin.
5 */
6
7/**
8 * @defgroup views_argument_validate_plugins Views' argument validate plugins
9 * @{
10 *
11 * Allow specialized methods of validating arguments.
12 *
13 * @see hook_views_plugins
14 */
15
16/**
17 * Base argument validator plugin to provide basic functionality.
18 *
19 * @ingroup views_argument_validate_plugins
20 */
21class views_plugin_argument_validate extends views_plugin {
22  var $option_name = 'validate_argument';
23
24  /**
25   * Initialize this plugin with the view and the argument
26   * it is linked to.
27   */
28  function init(&$view, &$argument, $id = NULL) {
29    $this->view = &$view;
30    $this->argument = &$argument;
31    $this->id = $id;
32  }
33
34  /**
35   * Determine if the administrator has the privileges to use this
36   * plugin
37   */
38  function access() { return TRUE; }
39
40  function argument_form(&$form, &$form_state) {
41  }
42
43  /**
44   * If we don't have access to the form but are showing it anyway, ensure that
45   * the form is safe and cannot be changed from user input.
46   */
47  function check_access(&$form) {
48    if (!$this->access()) {
49      $form[$this->option_name]['#disabled'] = TRUE;
50      $form[$this->option_name]['#value'] = $form[$this->option_name]['#default_value'];
51      $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>';
52    }
53  }
54
55  /**
56   * Return the validate argument.
57   */
58  function get_argument() {
59    return isset($this->argument->options[$this->option_name]) ? $this->argument->options[$this->option_name] : '';
60  }
61
62  function validate_form(&$form, &$form_state) { }
63
64  function validate_argument($arg) { return TRUE; }
65}
66
67/**
68 * @}
69 */
70
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.