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/node/views_plugin_row_node_view.inc
2 2

  
3 3
/**
4 4
 * @file
5
 * Contains the node view row style plugin.
5
 * Definition of views_plugin_row_node_view.
6 6
 */
7 7

  
8 8
/**
......
13 13
 * @ingroup views_row_plugins
14 14
 */
15 15
class views_plugin_row_node_view extends views_plugin_row {
16
  // Basic properties that let the row style follow relationships.
17
  var $base_table = 'node';
18
  var $base_field = 'nid';
19 16

  
20
  // Stores the nodes loaded with pre_render.
21
  var $nodes = array();
17
  /**
18
   * Basic properties that let the row style follow relationships.
19
   */
20
  public $base_table = 'node';
21

  
22
  /**
23
   *
24
   */
25
  public $base_field = 'nid';
22 26

  
23
  function init(&$view, &$display, $options = NULL) {
27
  /**
28
   * Stores the nodes loaded with pre_render.
29
   */
30
  public $nodes = array();
31

  
32
  /**
33
   * {@inheritdoc}
34
   */
35
  public function init(&$view, &$display, $options = NULL) {
24 36
    parent::init($view, $display, $options);
25 37
    // Handle existing views with the deprecated 'teaser' option.
26 38
    if (isset($this->options['teaser'])) {
......
32 44
    }
33 45
  }
34 46

  
35
  function option_definition() {
47
  /**
48
   * {@inheritdoc}
49
   */
50
  public function option_definition() {
36 51
    $options = parent::option_definition();
37 52

  
38 53
    $options['view_mode'] = array('default' => 'teaser');
......
42 57
    return $options;
43 58
  }
44 59

  
45
  function options_form(&$form, &$form_state) {
60
  /**
61
   * {@inheritdoc}
62
   */
63
  public function options_form(&$form, &$form_state) {
46 64
    parent::options_form($form, $form_state);
47 65

  
48 66
    $options = $this->options_form_summary_options();
......
51 69
      '#options' => $options,
52 70
      '#title' => t('View mode'),
53 71
      '#default_value' => $this->options['view_mode'],
54
     );
72
    );
55 73
    $form['links'] = array(
56 74
      '#type' => 'checkbox',
57 75
      '#title' => t('Display links'),
......
68 86
  /**
69 87
   * Return the main options, which are shown in the summary title.
70 88
   */
71
  function options_form_summary_options() {
89
  public function options_form_summary_options() {
72 90
    $entity_info = entity_get_info('node');
73 91
    $options = array();
74 92
    if (!empty($entity_info['view modes'])) {
......
79 97
    if (empty($options)) {
80 98
      $options = array(
81 99
        'teaser' => t('Teaser'),
82
        'full' => t('Full content')
100
        'full' => t('Full content'),
83 101
      );
84 102
    }
85 103

  
86 104
    return $options;
87 105
  }
88 106

  
89
  function summary_title() {
107
  /**
108
   * {@inheritdoc}
109
   */
110
  public function summary_title() {
90 111
    $options = $this->options_form_summary_options();
91 112
    return check_plain($options[$this->options['view_mode']]);
92 113
  }
93 114

  
94
  function pre_render($values) {
115
  /**
116
   * {@inheritdoc}
117
   */
118
  public function pre_render($values) {
95 119
    $nids = array();
96 120
    foreach ($values as $row) {
97 121
      $nids[] = $row->{$this->field_alias};
......
99 123
    $this->nodes = node_load_multiple($nids);
100 124
  }
101 125

  
102
  function render($row) {
126
  /**
127
   * {@inheritdoc}
128
   */
129
  public function render($row) {
103 130
    if (isset($this->nodes[$row->{$this->field_alias}])) {
104 131
      $node = $this->nodes[$row->{$this->field_alias}];
105 132
      $node->view = $this->view;
......
108 135
      return drupal_render($build);
109 136
    }
110 137
  }
138

  
111 139
}

Formats disponibles : Unified diff