When creating a "node_override" panel, I enable the context argument "Node ID" and specify the Node types: and Own display: to my liking of say, Page. (This allows for different layouts based on the node type)

The problem is with the Layout for the set Node Type. I am forced to use the "default" layout (and I am allowed to choose any layout option for the default) however, If I try to choose a layout for: Node ID 1 Page I receive the following error:

warning: Invalid argument supplied for foreach() in /home/puser/public_html/sites/all/modules/panels/includes/plugins.inc on line 584.

This was happening on 2.0-b2 so I updated tonight to the latest dev release [2008-02-21] but received the same error.

No hurry on a fix for my end, I was playing around and happened to run into the problem.

Comments

SamRose’s picture

Version: 5.x-2.x-dev » 5.x-2.0-beta3

Sam thing happening here.

Here is the block of code reagion in question from plugins.inc:

/**
 * Clear all cached content for a display.
 */
function panels_clear_cached_content($display) {
  // Figure out every method we might be using to cache content in this display:
  $methods = array();
  if (!empty($display->cache['method'])) {
    $methods[$display->cache['method']] = TRUE;
  }

  foreach ($display->content as $pane) {
    if (!empty($pane->cache['method'])) {
      $methods[$pane->cache['method']] = TRUE;
    }
  }

  foreach (array_keys($methods) as $method) {
    $function = panels_plugin_get_function('cache', $method, 'cache clear');
    if ($function) {
      $function($display);
    }
  }
}

and here is where line 584 starts:

 foreach ($display->content as $pane) {
    if (!empty($pane->cache['method'])) {
      $methods[$pane->cache['method']] = TRUE;
    }
  }

I tried to export, hand edit, and then re-import my panel page, but Drupal or the module seems to have wiped those layout settings from "Node 1 Page" portion. This was what I tried to insert there:

    $display->panel_settings = array (
  'width_type' => 'px',
  'percent_width' => '',
  'rows' => '3',
  'row_1' => 
  array (
    'columns' => '1',
    'width_1' => '100',
    'names' => 
    array (
      0 => 'Top',
    ),
  ),
  'row_2' => 
  array (
    'columns' => '3',
    'width_1' => '0',
    'width_2' => '900',
    'width_3' => '100',
    'names' => 
    array (
      0 => 'Left',
      1 => 'Middle',
      2 => 'Right',
    ),
  ),
  'row_3' => 
  array (
    'columns' => '1',
    'width_1' => '200',
    'names' => 
    array (
      0 => 'Bottom',
    ),
  ),
  'sidebars' => 
  array (
    'left' => 0,
    'left_width' => 200,
    'right' => 0,
    'right_width' => 200,
    'width_type' => 'px',
  ),
);

Drupal (or the module) is ignoring that. If I try to select a layout setting for "Node 1 Page" I get the same error above again:

warning: Invalid argument supplied for foreach() in /home/puser/public_html/sites/all/modules/panels/includes/plugins.inc on line 584.
niklp’s picture

This is true, it does break. However, you can get around this if you use the "flexible" layout, and then ignore the Layout tab, instead choosing to configure your panel layout under the Layout Settings tabs.

This is a critical issue though, as far as getting good node override panels working is concerned.

samsouk’s picture

same issue for me

there is a patch here http://drupal.org/node/251811 (code needs review)
this is a two lines patch and fixes my problem

niklp’s picture

Status: Active » Closed (duplicate)

Marking duplicate, although it seems that Gordon shoulda posted his patch here really, but hey... what ya gonna do.

Seems to be an identical issue, so please see: http://drupal.org/node/251811