Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've used the hook_panels_pre_render to create a new pane that is added on every node of a specific type. ( movie in this case )
/**
* Implements hook_panels_pre_render().
*/
function MYMODULE_panels_pre_render($panels_display, $renderer) {
global $language;
if ($node = $panels_display->context['panelizer']->data) {
if ($node->type == 'movie') {
$fpid = 1699;
if ($language->language == 'en') {
$fpid = 1721;
}
foreach ($panels_display->content as $panel) {
if ($panel->subtype == "fpid:$fpid" && $panel->panel == 'row2_right') {
return;
}
}
$new_pane = panels_new_pane('fieldable_panels_pane', "fpid:$fpid", TRUE);
$new_pane->panel = 'row2_right';
$panels_display->panels['row2_right'][] = $new_pane->pid;
$panels_display->content[$new_pane->pid] = $new_pane;
}
}
}
In the previous installed version (3.5) this added a new pane which I could edit.
Now I get a ajax error "Invalid pane id."
I've used the debugger to trace it to the edit link where the $pid = 'new' instead of an id.
Do I need to change this function to create a pane to insert in the region 'row2_right' ?
Comments
Comment #2
scuba_fly