Projet

Général

Profil

Révision c304a780

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_display_ctools_context.inc
1 1
<?php
2

  
2 3
/**
3 4
 * @file
4 5
 * Contains the block display plugin.
......
14 15
   * If this variable is true, this display counts as a context. We use this
15 16
   * variable so that we can easily build plugins against this display type.
16 17
   */
17
  var $context_display = TRUE;
18
  public $context_display = TRUE;
19

  
20

  
21
  public function get_style_type() {
22
    return 'context';
23
  }
18 24

  
19
  function get_style_type() { return 'context'; }
20 25

  
21
  function defaultable_sections($section = NULL) {
22
    if (in_array($section, array('style_options', 'style_plugin', 'row_options', 'row_plugin',))) {
26
  public function defaultable_sections($section = NULL) {
27
    if (in_array($section, array('style_options', 'style_plugin', 'row_options', 'row_plugin'))) {
23 28
      return FALSE;
24 29
    }
25 30

  
26 31
    return parent::defaultable_sections($section);
27 32
  }
28 33

  
29
  function option_definition() {
34

  
35
  public function option_definition() {
30 36
    $options = parent::option_definition();
31 37

  
32 38
    $options['admin_title'] = array('default' => '', 'translatable' => TRUE);
......
47 53
  /**
48 54
   * The display block handler returns the structure necessary for a block.
49 55
   */
50
  function execute() {
56
  public function execute() {
51 57
    $this->executing = TRUE;
52 58
    return $this->view->render();
53 59
  }
54 60

  
55
  function preview() {
61

  
62
  public function preview() {
56 63
    $this->previewing = TRUE;
57 64
    return $this->view->render();
58 65
  }
......
60 67
  /**
61 68
   * Render this display.
62 69
   */
63
  function render() {
70
  public function render() {
64 71
    if (!empty($this->previewing)) {
65 72
      return theme($this->theme_functions(), array('view' => $this->view));
66 73
    }
......
71 78
      $hooks = theme_get_registry();
72 79
      $info = $hooks[$this->definition['theme']];
73 80
      if (!empty($info['file'])) {
74
        @include_once('./' . $info['path'] . '/' . $info['file']);
81
        @include_once './' . $info['path'] . '/' . $info['file'];
75 82
      }
76 83
      $this->variables = array('view' => &$this->view);
77 84

  
......
92 99
   *
93 100
   * This output is returned as an array.
94 101
   */
95
  function options_summary(&$categories, &$options) {
102
  public function options_summary(&$categories, &$options) {
96 103
    // It is very important to call the parent function here:
97 104
    parent::options_summary($categories, $options);
98 105

  
......
135 142
  /**
136 143
   * Provide the default form for setting options.
137 144
   */
138
  function options_form(&$form, &$form_state) {
145
  public function options_form(&$form, &$form_state) {
139 146
    // It is very important to call the parent function here:
140 147
    parent::options_form($form, $form_state);
141 148
    switch ($form_state['section']) {
......
143 150
        // This just overwrites the existing row_plugin which is using the wrong options.
144 151
        $form['row_plugin']['#options'] = views_fetch_plugin_names('row', 'normal', array($this->view->base_table));
145 152
        break;
153

  
146 154
      case 'admin_title':
147 155
        $form['#title'] .= t('Administrative title');
148 156

  
......
152 160
          '#description' => t('This is the title that will appear for this view context in the configure context dialog. If left blank, the view name will be used.'),
153 161
        );
154 162
        break;
163

  
155 164
      case 'inherit_panels_path':
156 165
        $form['#title'] .= t('Inherit path from panel display');
157 166

  
......
162 171
          '#description' => t('If yes, all links generated by Views, such as more links, summary links, and exposed input links will go to the panels display path, not the view, if the display has a path.'),
163 172
        );
164 173
        break;
174

  
165 175
      case 'argument_input':
166 176
        $form['#title'] .= t('Choose the data source for view arguments');
167 177
        $argument_input = $this->get_argument_input();
......
216 226
   * Perform any necessary changes to the form values prior to storage.
217 227
   * There is no need for this function to actually store the data.
218 228
   */
219
  function options_submit(&$form, &$form_state) {
229
  public function options_submit(&$form, &$form_state) {
220 230
    // It is very important to call the parent function here:
221 231
    parent::options_submit($form, $form_state);
222 232
    switch ($form_state['section']) {
......
234 244
   * the arguments doesn't cause the argument input field to just
235 245
   * break.
236 246
   */
237
  function get_argument_input() {
247
  public function get_argument_input() {
238 248
    $arguments = $this->get_option('argument_input');
239 249
    $handlers = $this->get_handlers('argument');
240 250

  
......
260 270
    return $output;
261 271
  }
262 272

  
263
  function get_path() {
273

  
274
  public function get_path() {
264 275
    if ($this->get_option('link_display') == 'custom_url' && $override_path = $this->get_option('link_url')) {
265 276
      return $override_path;
266 277
    }
......
269 280
    }
270 281
    return parent::get_path();
271 282
  }
283

  
272 284
}

Formats disponibles : Unified diff