Révision 08475715
Ajouté par Assos Assos il y a plus de 7 ans
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; |
|
146 | 148 |
$view->display_handler->set_pane_conf($conf); |
147 | 149 |
|
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 |
|
|
203 | 150 |
$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 |
} |
|
208 | 151 |
if ($allow['path_override'] && !empty($conf['path'])) { |
209 | 152 |
$view->override_path = $conf['path']; |
210 | 153 |
} |
... | ... | |
221 | 164 |
$block->title_link = $view->get_url(); |
222 | 165 |
} |
223 | 166 |
|
224 |
// more link |
|
225 |
if ($allow['more_link']) { |
|
226 |
if (empty($conf['more_link'])) { |
|
227 |
$view->display_handler->set_option('use_more', FALSE); |
|
228 |
} |
|
229 |
else { |
|
230 |
$view->display_handler->set_option('use_more', TRUE); |
|
231 |
// make sure the view runs the count query so we know whether or not the |
|
232 |
// more link applies. |
|
233 |
$view->get_total_rows = TRUE; |
|
234 |
} |
|
235 |
} |
|
236 |
|
|
237 |
if ($allow['items_per_page'] && isset($conf['items_per_page'])) { |
|
238 |
$view->set_items_per_page($conf['items_per_page']); |
|
239 |
} |
|
240 |
|
|
241 |
if ($allow['offset']) { |
|
242 |
$view->set_offset($conf['offset']); |
|
243 |
} |
|
244 |
|
|
245 |
if ($allow['use_pager']) { |
|
246 |
// Only set use_pager if they differ, this way we can avoid overwriting the |
|
247 |
// pager type that Views uses. |
|
248 |
$pager = $view->display_handler->get_option('pager'); |
|
249 |
if ($conf['use_pager'] && ($pager['type'] == 'none' || $pager['type'] == 'some')) { |
|
250 |
$pager['type'] = 'full'; |
|
251 |
} |
|
252 |
elseif (!$conf['use_pager'] && $pager['type'] != 'none' && $pager['type'] != 'some') { |
|
253 |
$pager['type'] = $view->get_items_per_page() || !empty($pager['options']['items_per_page']) ? 'some' : 'none'; |
|
254 |
} |
|
255 |
|
|
256 |
if ($conf['use_pager']) { |
|
257 |
if (!isset($pager['options']['id']) || (isset($conf['pager_id']) && $pager['options']['id'] != $conf['pager_id'])) { |
|
258 |
$pager['options']['id'] = (int) $conf['pager_id']; |
|
259 |
} |
|
260 |
} |
|
261 |
|
|
262 |
$view->display_handler->set_option('pager', $pager); |
|
263 |
} |
|
264 |
|
|
265 |
if ($allow['fields_override']) { |
|
266 |
if ($conf['fields_override']) { |
|
267 |
$fields = $view->get_items('field'); |
|
268 |
foreach ($fields as $field => $field_display) { |
|
269 |
$fields[$field]['exclude'] = empty($conf['fields_override'][$field]); |
|
270 |
} |
|
271 |
$view->display_handler->set_option('fields', $fields); |
|
272 |
|
|
273 |
} |
|
274 |
} |
|
275 |
|
|
276 |
if ($allow['exposed_form'] && !empty($conf['exposed'])) { |
|
277 |
foreach ($conf['exposed'] as $filter_name => $filter_value) { |
|
278 |
if (!is_array($filter_value)) { |
|
279 |
$conf['exposed'][$filter_name] = ctools_context_keyword_substitute($filter_value, array(), $contexts); |
|
280 |
} |
|
281 |
} |
|
282 |
$view->set_exposed_input($conf['exposed']); |
|
283 |
} |
|
284 |
|
|
285 | 167 |
$stored_feeds = drupal_add_feed(); |
286 | 168 |
|
287 | 169 |
$block->content = $view->preview(); |
Formats disponibles : Unified diff
Weekly update of contrib modules