Projet

Général

Profil

Révision 7e72b748

Ajouté par Assos Assos il y a plus de 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/views_content/plugins/content_types/views_panes.inc
143 143
    return;
144 144
  }
145 145

  
146
  $conf['pane_contexts'] = $contexts;
147
  $conf['panel_args'] = $panel_args;
148 146
  $view->display_handler->set_pane_conf($conf);
149 147

  
148
  $args = array();
149
  $arguments = $view->display_handler->get_option('arguments');
150

  
151
  $context_keys = isset($conf['context']) ? $conf['context'] : array();
152
  foreach ($view->display_handler->get_argument_input() as $id => $argument) {
153
    switch ($argument['type']) {
154
      case 'context':
155
        $key = array_shift($context_keys);
156
        if (isset($contexts[$key])) {
157
          if (strpos($argument['context'], '.')) {
158
            list($context, $converter) = explode('.', $argument['context'], 2);
159
            $args[] = ctools_context_convert_context($contexts[$key], $converter, array('sanitize' => FALSE));
160
          }
161
          else {
162
            $args[] = $contexts[$key]->argument;
163
          }
164
        }
165
        else {
166
          $args[] = isset($arguments[$id]['exception']['value']) ? $arguments[$id]['exception']['value'] : 'all';
167
        }
168
        break;
169

  
170
      case 'fixed':
171
        $args[] = $argument['fixed'];
172
        break;
173

  
174
      case 'panel':
175
        $args[] = isset($panel_args[$argument['panel']]) ? $panel_args[$argument['panel']] : NULL;
176
        break;
177

  
178
      case 'user':
179
        $args[] = (isset($conf['arguments'][$id])  && $conf['arguments'][$id] !== '') ? ctools_context_keyword_substitute($conf['arguments'][$id], array(), $contexts) : NULL;
180
        break;
181

  
182
     case 'wildcard':
183
        // Put in the wildcard.
184
       $args[] = isset($arguments[$id]['wildcard']) ? $arguments[$id]['wildcard'] : '*';
185
       break;
186

  
187
     case 'none':
188
     default:
189
       // Put in NULL.
190
       // views.module knows what to do with NULL (or missing) arguments
191
       $args[] = NULL;
192
       break;
193
    }
194
  }
195

  
196
  // remove any trailing NULL arguments as these are non-args:
197
  while (count($args) && end($args) === NULL) {
198
    array_pop($args);
199
  }
200

  
201
  $view->set_arguments($args);
202

  
150 203
  $allow = $view->display_handler->get_option('allow');
204

  
205
  if (!empty($conf['path'])) {
206
    $conf['path'] = ctools_context_keyword_substitute($conf['path'], array(), $contexts);
207
  }
151 208
  if ($allow['path_override'] && !empty($conf['path'])) {
152 209
    $view->override_path = $conf['path'];
153 210
  }
154 211
  else if ($path = $view->display_handler->get_option('inherit_panels_path')) {
155
    $view->override_path = $_GET['q'];
212
    if (drupal_is_front_page()) {
213
      $view->override_path = '';
214
    }
215
    else {
216
      $view->override_path = $_GET['q'];
217
    }
156 218
  }
157 219

  
158 220
  $block = new stdClass();
......
164 226
    $block->title_link = $view->get_url();
165 227
  }
166 228

  
229
  // more link
230
  if ($allow['more_link']) {
231
    if (empty($conf['more_link'])) {
232
      $view->display_handler->set_option('use_more', FALSE);
233
    }
234
    else {
235
      $view->display_handler->set_option('use_more', TRUE);
236
      // make sure the view runs the count query so we know whether or not the
237
      // more link applies.
238
      $view->get_total_rows = TRUE;
239
    }
240
  }
241

  
242
  if ($allow['items_per_page'] && isset($conf['items_per_page'])) {
243
    $view->set_items_per_page($conf['items_per_page']);
244
  }
245

  
246
  if ($allow['offset']) {
247
    $view->set_offset($conf['offset']);
248
  }
249

  
250
  if ($allow['use_pager']) {
251
    // Only set use_pager if they differ, this way we can avoid overwriting the
252
    // pager type that Views uses.
253
    $pager = $view->display_handler->get_option('pager');
254
    if ($conf['use_pager'] && ($pager['type'] == 'none' || $pager['type'] == 'some')) {
255
      $pager['type'] = 'full';
256
    }
257
    elseif (!$conf['use_pager'] && $pager['type'] != 'none' && $pager['type'] != 'some') {
258
      $pager['type'] = $view->get_items_per_page() || !empty($pager['options']['items_per_page']) ? 'some' : 'none';
259
    }
260

  
261
    if ($conf['use_pager']) {
262
      if (!isset($pager['options']['id']) || (isset($conf['pager_id']) && $pager['options']['id'] != $conf['pager_id'])) {
263
        $pager['options']['id'] = (int) $conf['pager_id'];
264
      }
265
    }
266

  
267
    $view->display_handler->set_option('pager', $pager);
268
  }
269

  
270
  if ($allow['fields_override']) {
271
    if ($conf['fields_override']) {
272
      $fields = $view->get_items('field');
273
      foreach ($fields as $field => $field_display) {
274
        $fields[$field]['exclude'] = empty($conf['fields_override'][$field]);
275
      }
276
      $view->display_handler->set_option('fields', $fields);
277

  
278
    }
279
  }
280

  
281
  if ($allow['exposed_form'] && !empty($conf['exposed'])) {
282
    foreach ($conf['exposed'] as $filter_name => $filter_value) {
283
      if (!is_array($filter_value)) {
284
        $conf['exposed'][$filter_name] = ctools_context_keyword_substitute($filter_value, array(), $contexts);
285
      }
286
    }
287
    $view->set_exposed_input($conf['exposed']);
288
  }
289

  
167 290
  $stored_feeds = drupal_add_feed();
168 291

  
169 292
  $block->content = $view->preview();

Formats disponibles : Unified diff