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/views/views_content_plugin_display_panel_pane.inc
48 48
    return isset($this->has_pane_conf);
49 49
  }
50 50

  
51
  function set_pane_conf($conf = array(), $set_cache = TRUE) {
51
  function set_pane_conf($conf = array()) {
52 52
    $this->set_option('pane_conf', $conf);
53
    $this->view->dom_id = !empty($this->view->dom_id) ? $this->view->dom_id : md5($this->view->name . REQUEST_TIME . rand());
54
    if ($set_cache) {
55
      cache_set('view_panel_pane_' . $this->view->dom_id, $conf);
56
    }
57 53
    $this->has_pane_conf = TRUE;
58 54
  }
59 55

  
......
416 412
    return empty($conf['exposed_form']);
417 413
  }
418 414

  
419
  /**
420
   * Set the pane configuration options
421
   * Done here in handler for reuse between views_content_views_panes_content_type_render
422
   * and views_content_views_pre_view
423
   */
424
  function pane_process_conf() {
425
    ctools_include('context');
426
    $conf = $this->get_option('pane_conf');
427
    if (!$conf) {
428
      // See if dom id has been cached and get conf from there.
429
      if (!empty($this->view->dom_id) && ($cache = cache_get('view_panel_pane_' . $this->view->dom_id))) {
430
        $conf = $cache->data;
431
      }
432
      if (!$conf) {
433
        return;
434
      }
435
      $this->set_pane_conf($conf);
436
    }
437
    $contexts = $conf['pane_contexts'];
438
    $panel_args = $conf['panel_args'];
439
    $args = array();
440
    $arguments = $this->get_option('arguments');
441

  
442
    $context_keys = isset($conf['context']) ? $conf['context'] : array();
443
    foreach ($this->get_argument_input() as $id => $argument) {
444
      switch ($argument['type']) {
445
        case 'context':
446
          $key = array_shift($context_keys);
447
          if (isset($contexts[$key])) {
448
            if (strpos($argument['context'], '.')) {
449
              list($context, $converter) = explode('.', $argument['context'], 2);
450
              $args[] = ctools_context_convert_context($contexts[$key], $converter, array('sanitize' => FALSE));
451
            }
452
            else {
453
              $args[] = $contexts[$key]->argument;
454
            }
455
          }
456
          else {
457
            $args[] = isset($arguments[$id]['exception']['value']) ? $arguments[$id]['exception']['value'] : 'all';
458
          }
459
          break;
460

  
461
        case 'fixed':
462
          $args[] = $argument['fixed'];
463
          break;
464

  
465
        case 'panel':
466
          $args[] = isset($panel_args[$argument['panel']]) ? $panel_args[$argument['panel']] : NULL;
467
          break;
468

  
469
        case 'user':
470
          $args[] = (isset($conf['arguments'][$id])  && $conf['arguments'][$id] !== '') ? ctools_context_keyword_substitute($conf['arguments'][$id], array(), $contexts) : NULL;
471
          break;
472

  
473
       case 'wildcard':
474
          // Put in the wildcard.
475
         $args[] = isset($arguments[$id]['wildcard']) ? $arguments[$id]['wildcard'] : '*';
476
         break;
477

  
478
       case 'none':
479
       default:
480
         // Put in NULL.
481
         // views.module knows what to do with NULL (or missing) arguments
482
         $args[] = NULL;
483
         break;
484
      }
485
    }
486

  
487
    // remove any trailing NULL arguments as these are non-args:
488
    while (count($args) && end($args) === NULL) {
489
      array_pop($args);
490
    }
491

  
492
    $this->view->set_arguments($args);
493
    $allow = $this->get_option('allow');
494

  
495
    if (!empty($conf['path'])) {
496
      $conf['path'] = ctools_context_keyword_substitute($conf['path'], array(), $contexts);
497
    }
498
    if ($allow['path_override'] && !empty($conf['path'])) {
499
      $this->view->override_path = $conf['path'];
500
    }
501
    else if ($path = $this->get_option('inherit_panels_path')) {
502
      $this->view->override_path = $_GET['q'];
503
    }
504

  
505
    // more link
506
    if ($allow['more_link']) {
507
      if (empty($conf['more_link'])) {
508
        $this->set_option('use_more', FALSE);
509
      }
510
      else {
511
        $this->set_option('use_more', TRUE);
512
        // make sure the view runs the count query so we know whether or not the
513
        // more link applies.
514
        $this->view->get_total_rows = TRUE;
515
      }
516
    }
517

  
518
    if ($allow['items_per_page'] && isset($conf['items_per_page'])) {
519
      $this->view->set_items_per_page($conf['items_per_page']);
520
    }
521

  
522
    if ($allow['offset']) {
523
      $this->view->set_offset($conf['offset']);
524
    }
525

  
526
    if ($allow['use_pager']) {
527
      // Only set use_pager if they differ, this way we can avoid overwriting the
528
      // pager type that Views uses.
529
      $pager = $this->get_option('pager');
530
      if ($conf['use_pager'] && ($pager['type'] == 'none' || $pager['type'] == 'some')) {
531
        $pager['type'] = 'full';
532
      }
533
      elseif (!$conf['use_pager'] && $pager['type'] != 'none' && $pager['type'] != 'some') {
534
        $pager['type'] = $this->view->get_items_per_page() || !empty($pager['options']['items_per_page']) ? 'some' : 'none';
535
      }
536

  
537
      if ($conf['use_pager']) {
538
        if (!isset($pager['options']['id']) || (isset($conf['pager_id']) && $pager['options']['id'] != $conf['pager_id'])) {
539
          $pager['options']['id'] = (int) $conf['pager_id'];
540
        }
541
      }
542

  
543
      $this->set_option('pager', $pager);
544
    }
545

  
546
    if ($allow['fields_override']) {
547
      if ($conf['fields_override']) {
548
        $fields = $this->view->get_items('field');
549
        foreach ($fields as $field => $field_display) {
550
          $fields[$field]['exclude'] = empty($conf['fields_override'][$field]);
551
        }
552
        $this->set_option('fields', $fields);
553

  
554
      }
555
    }
556

  
557
    if ($allow['exposed_form'] && !empty($conf['exposed'])) {
558
      foreach ($conf['exposed'] as $filter_name => $filter_value) {
559
        if (!is_array($filter_value)) {
560
          $conf['exposed'][$filter_name] = ctools_context_keyword_substitute($filter_value, array(), $contexts);
561
        }
562
      }
563
      $this->view->set_exposed_input($conf['exposed']);
564
    }
565
  }
566

  
567 415
}
568 416

  

Formats disponibles : Unified diff