Projet

Général

Profil

Révision d719f12f

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/handlers/views_handler_area_view.inc
51 51
   * Render the area
52 52
   */
53 53
  function render($empty = FALSE) {
54
    if (!empty($this->options['view_to_insert'])) {
55
      list($view_name, $display_id) = explode(':', $this->options['view_to_insert']);
56

  
57
      $view = views_get_view($view_name);
58
      if (empty($view) || !$view->access($display_id)) {
59
        return;
60
      }
61
      $view->set_display($display_id);
62

  
63
      // Avoid recursion
64
      $view->parent_views += $this->view->parent_views;
65
      $view->parent_views[] = "$view_name:$display_id";
66

  
67
      // Check if the view is part of the parent views of this view
68
      $search = "$view_name:$display_id";
69
      if (in_array($search, $this->view->parent_views)) {
70
        drupal_set_message(t("Recursion detected in view @view display @display.", array('@view' => $view_name, '@display' => $display_id)), 'error');
54
    if ($view = $this->loadView()) {
55
      if (!empty($this->options['inherit_arguments']) && !empty($this->view->args)) {
56
        return $view->preview(NULL, $this->view->args);
71 57
      }
72 58
      else {
73
        if (!empty($this->options['inherit_arguments']) && !empty($this->view->args)) {
74
          return $view->preview($display_id, $this->view->args);
75
        }
76
        else {
77
          return $view->preview($display_id);
78
        }
59
        return $view->preview(NULL);
79 60
      }
80 61
    }
81 62
    return '';
82 63
  }
64

  
65
  /**
66
   * Loads the used view for rendering.
67
   *
68
   * @return \view|NULL
69
   *   The loaded view or NULL, in case the view was not loadable / recursion
70
   *   got detected / access got denied.
71
   */
72
  protected function loadView() {
73
    if (empty($this->options['view_to_insert'])) {
74
      return NULL;
75
    }
76
    list($view_name, $display_id) = explode(':', $this->options['view_to_insert']);
77

  
78
    $view = views_get_view($view_name);
79
    if (empty($view) || !$view->access($display_id)) {
80
      return NULL;
81
    }
82
    $view->set_display($display_id);
83

  
84
    // Avoid recursion.
85
    $view->parent_views += $this->view->parent_views;
86
    $view->parent_views[] = "$view_name:$display_id";
87

  
88
    // Check if the view is part of the parent views of this view.
89
    $search = "$view_name:$display_id";
90
    if (in_array($search, $this->view->parent_views)) {
91
      drupal_set_message(t("Recursion detected in view @view display @display.", array('@view' => $view_name, '@display' => $display_id)), 'error');
92
      return NULL;
93
    }
94

  
95
    return $view;
96
  }
97

  
83 98
}

Formats disponibles : Unified diff