Révision 64156087
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/panels/plugins/display_renderers/panels_renderer_standard.class.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
|
3 |
/** |
|
4 |
* @file |
|
5 |
*/ |
|
6 |
|
|
3 | 7 |
/** |
4 | 8 |
* The standard render pipeline for a Panels display object. |
5 | 9 |
* |
... | ... | |
48 | 52 |
* with some exceptions (@see panels_renderer_legacy for details). The approach |
49 | 53 |
* here differs primarily in its friendliness to tweaking in subclasses. |
50 | 54 |
*/ |
55 |
/** |
|
56 |
* |
|
57 |
*/ |
|
51 | 58 |
class panels_renderer_standard { |
52 | 59 |
/** |
53 | 60 |
* The fully-loaded Panels display object that is to be rendered. "Fully |
... | ... | |
209 | 216 |
* method via parent::prepare(), or manually set $this->prep_run = TRUE. |
210 | 217 |
* |
211 | 218 |
* @param mixed $external_settings |
212 |
* An optional parameter allowing external code to pass in additional |
|
213 |
* settings for use in the preparation process. Not used in the default |
|
214 |
* renderer, but included for interface consistency. |
|
219 |
* An optional parameter allowing external code to pass in additional
|
|
220 |
* settings for use in the preparation process. Not used in the default
|
|
221 |
* renderer, but included for interface consistency.
|
|
215 | 222 |
*/ |
216 | 223 |
function prepare($external_settings = NULL) { |
217 | 224 |
$this->prepare_panes($this->display->content); |
... | ... | |
232 | 239 |
* regularly make additions to the set of panes that will be rendered. |
233 | 240 |
* |
234 | 241 |
* @param array $panes |
235 |
* An associative array of pane data (stdClass objects), keyed on pane id. |
|
242 |
* An associative array of pane data (stdClass objects), keyed on pane id. |
|
243 |
* |
|
236 | 244 |
* @return array |
237 | 245 |
* An associative array of panes to be rendered, keyed on pane id and sorted |
238 | 246 |
* into proper rendering order. |
239 | 247 |
*/ |
240 | 248 |
function prepare_panes($panes) { |
241 | 249 |
ctools_include('content'); |
242 |
// Use local variables as writing to them is very slightly faster |
|
250 |
// Use local variables as writing to them is very slightly faster.
|
|
243 | 251 |
$first = $normal = $last = array(); |
244 | 252 |
|
245 |
// Prepare the list of panes to be rendered |
|
253 |
// Prepare the list of panes to be rendered.
|
|
246 | 254 |
foreach ($panes as $pid => $pane) { |
247 | 255 |
if (empty($this->admin)) { |
248 |
// TODO remove in 7.x and ensure the upgrade path weeds out any stragglers; it's been long enough |
|
249 |
$pane->shown = !empty($pane->shown); // guarantee this field exists. |
|
250 |
// If this pane is not visible to the user, skip out and do the next one |
|
256 |
// TODO remove in 7.x and ensure the upgrade path weeds out any stragglers; it's been long enough. |
|
257 |
$pane->shown = !empty($pane->shown); |
|
258 |
// Guarantee this field exists. |
|
259 |
// If this pane is not visible to the user, skip out and do the next one. |
|
251 | 260 |
if (!$pane->shown || !panels_pane_access($pane, $this->display)) { |
252 | 261 |
continue; |
253 | 262 |
} |
... | ... | |
272 | 281 |
// If it wants to render first, add it to the $first array. This is used |
273 | 282 |
// by panes that need to do some processing before other panes are |
274 | 283 |
// rendered. |
275 |
else if (!empty($content_type['render first'])) {
|
|
284 |
elseif (!empty($content_type['render first'])) { |
|
276 | 285 |
$first[$pid] = $pane; |
277 | 286 |
} |
278 | 287 |
// Otherwise, render it in the normal order. |
... | ... | |
318 | 327 |
* @param array $settings |
319 | 328 |
* All known region style settings, including both the top-level display's |
320 | 329 |
* settings (if any) and all region-specific settings (if any). |
330 |
* |
|
321 | 331 |
* @return array |
322 | 332 |
* An array of regions prepared for rendering. |
323 | 333 |
*/ |
... | ... | |
497 | 507 |
case 'standard': |
498 | 508 |
drupal_add_css($filename); |
499 | 509 |
break; |
510 |
|
|
500 | 511 |
case 'inline': |
501 | 512 |
$url = base_path() . $filename; |
502 |
$this->prefix .= '<link type="text/css" rel="stylesheet" href="' . file_create_url($url) . '" />'."\n";
|
|
513 |
$this->prefix .= '<link type="text/css" rel="stylesheet" href="' . file_create_url($url) . '" />' . "\n";
|
|
503 | 514 |
break; |
504 | 515 |
} |
505 | 516 |
} |
... | ... | |
533 | 544 |
* an individual pane can be bubbled up to take over the title for the entire |
534 | 545 |
* display. |
535 | 546 |
* |
536 |
* @param stdClass $pane
|
|
537 |
* A Panels pane object, as loaded from the database. |
|
547 |
* @param object $pane
|
|
548 |
* A Panels pane object, as loaded from the database.
|
|
538 | 549 |
*/ |
539 | 550 |
function render_pane(&$pane) { |
540 | 551 |
module_invoke_all('panels_pane_prerender', $pane); |
... | ... | |
567 | 578 |
} |
568 | 579 |
} |
569 | 580 |
|
570 |
// fallback
|
|
581 |
// Fallback.
|
|
571 | 582 |
return theme('panels_pane', array('content' => $content, 'pane' => $pane, 'display' => $this->display)); |
572 | 583 |
} |
573 | 584 |
} |
... | ... | |
578 | 589 |
* This method retrieves pane content and produces a ready-to-render content |
579 | 590 |
* object. It also manages pane-specific caching. |
580 | 591 |
* |
581 |
* @param stdClass $pane
|
|
592 |
* @param object $pane
|
|
582 | 593 |
* A Panels pane object, as loaded from the database. |
594 |
* |
|
583 | 595 |
* @return stdClass $content |
584 | 596 |
* A renderable object, containing a subject, content, etc. Based on the |
585 | 597 |
* renderable objects used by the block system. |
... | ... | |
693 | 705 |
$output = theme($style['render region'], array('display' => $this->display, 'owner_id' => $owner_id, 'panes' => $panes, 'settings' => $style_settings, 'region_id' => $region_id, 'style' => $style)); |
694 | 706 |
return $output; |
695 | 707 |
} |
708 |
|
|
696 | 709 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules