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/field/views_handler_argument_field_list.inc
12 12
 * @ingroup views_argument_handlers
13 13
 */
14 14
class views_handler_argument_field_list extends views_handler_argument_numeric {
15

  
15 16
  /**
16 17
   * Stores the allowed values of this field.
17 18
   *
18 19
   * @var array
19 20
   */
20
  var $allowed_values = NULL;
21
  public $allowed_values = NULL;
21 22

  
22
  function init(&$view, &$options) {
23
  /**
24
   * {@inheritdoc}
25
   */
26
  public function init(&$view, &$options) {
23 27
    parent::init($view, $options);
24 28
    $field = field_info_field($this->definition['field_name']);
25 29
    $this->allowed_values = list_allowed_values($field);
26 30
  }
27 31

  
28
  function option_definition() {
32
  /**
33
   * {@inheritdoc}
34
   */
35
  public function option_definition() {
29 36
    $options = parent::option_definition();
30 37
    $options['summary']['contains']['human'] = array('default' => FALSE, 'bool' => TRUE);
31 38

  
32 39
    return $options;
33 40
  }
34 41

  
35
  function options_form(&$form, &$form_state) {
42
  /**
43
   * {@inheritdoc}
44
   */
45
  public function options_form(&$form, &$form_state) {
36 46
    parent::options_form($form, $form_state);
37 47

  
38 48
    $form['summary']['human'] = array(
......
43 53
    );
44 54
  }
45 55

  
46

  
47
  function summary_name($data) {
56
  /**
57
   * {@inheritdoc}
58
   */
59
  public function summary_name($data) {
48 60
    $value = $data->{$this->name_alias};
49 61
    // If the list element has a human readable name show it,
50 62
    if (isset($this->allowed_values[$value]) && !empty($this->options['summary']['human'])) {
51 63
      return field_filter_xss($this->allowed_values[$value]);
52 64
    }
53
    // else fallback to the key.
65
    // Else fallback to the key.
54 66
    else {
55 67
      return check_plain($value);
56 68
    }
57 69
  }
70

  
58 71
}

Formats disponibles : Unified diff