Drupal Association members fund grants that make connections all over the world.
It would be useful for themers to retain the original $content variable in template_preprocess_panels_pane().
Currently it overwrites $vars['content'] with $vars['content']->content and you lose everything else that was in $vars['content'] that isn't $vars['content']->content.
Since many themers probably rely on the $vars array being as it currently is we can't change that without potentially breaking a bunch of websites so I propose just adding another variable to $vars that includes all of $vars['content'] except for $vars['content']->content (personally I don't see the point in including $vars['content']->content twice and wasting resources).
Maybe it could go in $vars['content_metadata'] or $vars['content_definition'] or $vars['content_context'] or something.
Original bug report
When you override template_preprocess_panels_pane() in your own theme, weirdness ensues when you just copy/paste and start altering anything which uses the $content variable within the provided function body. i.e. adding a another variation to the theme_hook_suggestions array.
How to reproduce
1. Install Drupal and Panels
2. Create a new theme
3. Override template_preprocess_panels_pane() in your own template.php
4. Verbatim copy/paste the function body from panels.module
5. Add a variation to the theme_hook_suggestions array: i.e. $vars['theme_hook_suggestions'] = $base . $delimiter . $content->type . -'test';
6. Create new template called panels-pane--custom-test.tpl.php in your theme and add some test html (or the contents from panels-pane.tpl.php)
7. Create a new custom page and add a custom content panel
8. Clear your caches
9. Notice how the region in your custom page will appear empty.
Expected behaviour: you should see the output piped through the panels-pane--custom-test.tpl.php template.
The body of the template_preprocess_panels_pane() starts and ends with:
$content = &$vars['content'];
$vars['content'] = !empty($content->content) ? $content->content : ''; (line 1298 in panels.module)
The original $content variable within the panels.module context is an object with a few properties like 'type', 'subtype', 'title' and 'content'. At the end of the execution of the original function, the $vars['content'] gets overwritten with the 'content' property.
Overriding in template.php doesn't mean that the original template_preprocess_* won't be executed. It will be executed followed by the execution of the specific function in template.php passing $vars by reference to allow final tweaking. Since $vars['content'] is overwritten when the theme() function enters template.php, we only get a "lousy string" instead of a nice object.
Remove the assign at line 1298 fixes the issue and passes $vars['content'] as a nice object to possible preprocess overrides instead of a non-flexible string.