Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/modules/user/views_plugin_argument_default_user.inc
2 2

  
3 3
/**
4 4
 * @file
5
 * Contains the user from URL argument default plugin.
5
 * Definition of views_plugin_argument_default_user.
6 6
 */
7 7

  
8 8
/**
9 9
 * Default argument plugin to extract a user via menu_get_object.
10 10
 */
11 11
class views_plugin_argument_default_user extends views_plugin_argument_default {
12
  function option_definition() {
12

  
13
  /**
14
   * {@inheritdoc}
15
   */
16
  public function option_definition() {
13 17
    $options = parent::option_definition();
14 18
    $options['user'] = array('default' => '', 'bool' => TRUE, 'translatable' => FALSE);
15 19

  
16 20
    return $options;
17 21
  }
18 22

  
19
  function options_form(&$form, &$form_state) {
23
  /**
24
   * {@inheritdoc}
25
   */
26
  public function options_form(&$form, &$form_state) {
20 27
    $form['user'] = array(
21 28
      '#type' => 'checkbox',
22 29
      '#title' => t('Also look for a node and use the node author'),
......
24 31
    );
25 32
  }
26 33

  
27
  function convert_options(&$options) {
34
  /**
35
   * {@inheritdoc}
36
   */
37
  public function convert_options(&$options) {
28 38
    if (!isset($options['user']) && isset($this->argument->options['default_argument_user'])) {
29 39
      $options['user'] = $this->argument->options['default_argument_user'];
30 40
    }
31 41
  }
32 42

  
33
  function get_argument() {
43
  /**
44
   * {@inheritdoc}
45
   */
46
  public function get_argument() {
34 47
    foreach (range(1, 3) as $i) {
35 48
      $user = menu_get_object('user', $i);
36 49
      if (!empty($user)) {
......
67 80
      }
68 81
    }
69 82

  
70
    // If the current page is a view that takes uid as an argument, return the uid.
83
    // If the current page is a view that takes uid as an argument, return the
84
    // uid.
71 85
    $view = views_get_page_view();
72 86

  
73 87
    if ($view && isset($view->argument['uid'])) {
74 88
      return $view->argument['uid']->argument;
75 89
    }
76 90
  }
91

  
77 92
}

Formats disponibles : Unified diff