DrupalBin
Submit Code
About
Recent Posts
admin settings not saving
1 hour 11 min
ago
Code
1 hour 54 min
ago
Code
2 hours 10 min
ago
css path
3 hours 54 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for panels pane cloning, duplicating, etc
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
/** * Forms the basis of a panel display * * @ingroup mainapi */ class panels_display { var $args = array(); var $content = array(); var $panels = array(); var $incoming_content = NULL; var $css_id = NULL; var $context = array(); function add_pane($pane, $location = FALSE) { $pane->pid = $this->next_new_pid(); if (!$location || !isset($this->panels[$location])) { foreach ($this->panels as $panel_name => $panel) { if (array_key_exists($pid, $panel)) { $this->panels[$panel_name][] = $pid; } } } else { $this->panels[$location][] = $pane->pid; } } function duplicate_pane($pid, $location = FALSE) { $pane = $this->clone_pane($pid); $this->add_pane($pane, $location); } function clone_pane($pid) { $pane = drupal_clone($this->content[$pid]); foreach (array_keys($this->content) as $pidcheck) unset($pane->position); // necessary? return $pane; } function next_new_pid() { // necessary if/until we use this method and ONLY this method for adding temporary pids. // then we can do it with a nice static var. foreach (array_keys($this->content) as $pid) { if (!is_numeric($pid)) { $id[] = substr($pid, 4); } } return ++end($id); } } function panels_export_pane_across_displays($source_display, &$target_display, $pid, $location = FALSE) { $pane = $source_display->clone_pane($pid); $target_display->add_pane($pane, $location); }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.