I have an exported panel page that I've put into hook_default_panel_pages(). When viewing the panel page, i get the following warning and no output.

warning: Invalid argument supplied for foreach() in /Users/rlopez/workspace/d6-multisite/public_html/sites/all/modules/contrib/panels/includes/plugins.inc on line 855.

I also get several repeated php errors in the watchdog logs.

The specialized Panels menu router rebuild failed. Some paths may not work correctly.

The same warning is mentioned in #299098 with different symptoms.

The menu router error is mentioned in #311192 and #293124 though they also dont seem to be the same problem.

For reference, here is my hook_default_panel_pages()

function mymodule_default_panel_pages() {
  $page = new stdClass();
  $page->pid = 'new';
    $page->pid = '1';
    $page->name = 'Home';
    $page->did = '1';
    $page->title = 'Home';
    $page->access = array();
    $page->path = 'home';
    $page->load_flags = 0;
    $page->css_id = '';
    $page->css = '';
    $page->arguments = array();
    $page->relationships = array();
    $page->no_blocks = '1';
    $page->switcher_options = array();
    $page->menu = '0';
    $page->menu_tab = '0';
    $page->menu_tab_weight = '0';
    $page->menu_title = '';
    $page->menu_tab_default = '0';
    $page->menu_tab_default_parent_type = 'tab';
    $page->menu_parent_title = '';
    $page->menu_parent_tab_weight = '0';
  $page->contexts = array();
  $display = new panels_display();
  $display->did = 'new';
  $display->layout = 'twocol_stacked';
  $display->layout_settings = NULL;
  $display->panel_settings = array(
    'style' => 'default',
    'style_settings' => 
    array(
    ),
    'individual' => 0,
    'panel' => 
    array(
      'top' => 
      array(
        'style' => -1,
      ),
      'left' => 
      array(
        'style' => -1,
      ),
      'right' => 
      array(
        'style' => -1,
      ),
      'bottom' => 
      array(
        'style' => -1,
      ),
    ),
  );
  $display->content = array();
  $display->panels = array();
    $pane = new stdClass();
      $pane->pid = 'new-1';
      $pane->panel = 'left';
      $pane->type = 'block';
      $pane->subtype = 'views-news_blog-block_1';
      $pane->access = array();
      $pane->configuration = array(
        'style' => 'default',
        'override_title' => 0,
        'override_title_text' => '',
        'css_id' => '',
        'css_class' => '',
        'module' => 'views',
        'delta' => 'news_blog-block_1',
        'block_visibility' => 0,
      );
    $display->content['new-1'] = $pane;
    $display->panels['left'][0] = 'new-1';
    $pane = new stdClass();
      $pane->pid = 'new-2';
      $pane->panel = 'right';
      $pane->type = 'block';
      $pane->subtype = 'photo_gallery-galleries';
      $pane->access = array();
      $pane->configuration = array(
        'style' => 'default',
        'override_title' => 0,
        'override_title_text' => '',
        'css_id' => '',
        'css_class' => '',
        'module' => 'photo_gallery',
        'delta' => 'galleries',
        'block_visibility' => 0,
      );
    $display->content['new-2'] = $pane;
    $display->panels['right'][0] = 'new-2';
    $pane = new stdClass();
      $pane->pid = 'new-3';
      $pane->panel = 'right';
      $pane->type = 'block';
      $pane->subtype = 'fans-0';
      $pane->access = array();
      $pane->configuration = array(
        'style' => 'default',
        'override_title' => 0,
        'override_title_text' => '',
        'css_id' => '',
        'css_class' => '',
        'module' => 'fans',
        'delta' => '0',
        'block_visibility' => 0,
      );
    $display->content['new-3'] = $pane;
    $display->panels['right'][1] = 'new-3';
    $pane = new stdClass();
      $pane->pid = 'new-4';
      $pane->panel = 'right';
      $pane->type = 'block';
      $pane->subtype = 'user-3';
      $pane->access = array();
      $pane->configuration = array(
        'style' => 'default',
        'override_title' => 0,
        'override_title_text' => '',
        'css_id' => '',
        'css_class' => '',
        'module' => 'user',
        'delta' => '3',
        'block_visibility' => 0,
        'block_settings' => 
        array(
          'user_block_seconds_online' => '900',
          'user_block_max_list_count' => '10',
        ),
      );
    $display->content['new-4'] = $pane;
    $display->panels['right'][2] = 'new-4';
  $page->display = $display;
  $page->displays = array();
  return $page;
}

Comments

sdboyer’s picture

Assigned: Unassigned » sdboyer

Yeah, this is one area - that is, panels_pages that have been exported to code - that I really hadn't tested yet. I'll put an eye on it this weekend during my Panels time. I suspect that it'll be a relatively simple fix, but it will probably require some modifications in some semi-funky places.

sdboyer’s picture

Meh...I wish it was possible to easily watchdog in WHICH path caused the failure...

sdboyer’s picture

OK, the precise point of breakdown could be happening in a few different places, although the error you're getting is kinda just plain funky...

I'm gonna take the data home and work out exactly where the issue is.

sdboyer’s picture

Oh FFS, I hate it when I lose a HUGE post because I submit it on an expired cookie and I can't freaking GET IT BACK...

Short version: try -dev, I believe it's fixed. Let me know if it's not. The watchdog error, as far as I can tell, is unrelated to this problem. Also, I'd like to see a full dump of your panels_page and panels_page_router_store tables, if that's possible.

grndlvl’s picture

Still having issues with creating the default panel. The error is now gone, but It only seems to import the title, and layout of the panel. If I go to the panel context page it is it does not show the layout and when I go to the layout page it does not have anything selected. So tried manual import and it did not give any errors an brought up the next page, I clicked save, but it did not create the panel.

sdboyer’s picture

So the changes I committed were specifically focused on view-time execution - I can have a look at the edit-time knots in #5 next, but it'd be good to know if a simple, non-overridden default panel_page is working properly.

grndlvl’s picture

Merlin fixed the issues with this and is in latest dev. Although I have not tested the manual import. I will let you know how that goes tomorrow.

merlinofchaos’s picture

Status: Active » Fixed

I think we can call this fixed now.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.