You are here

function panels_page_panels_exportables in Panels 6.2

Same name and namespace in other branches
  1. 5.2 panels_page/panels_page.module \panels_page_panels_exportables()

Implementation of hook_panels_exportables().

File

panels_page/panels_page.module, line 481
panels_page.module

Code

function panels_page_panels_exportables($op = 'list', $panels = NULL, $name = 'foo') {
  static $all_panels = NULL;
  if ($op == 'list') {
    if (empty($all_panels)) {
      panels_page_load_include('read');
      $all_panels = panels_page_load_all();
    }
    foreach ($all_panels as $name => $panel) {
      $return[$name] = check_plain($name) . ' (' . check_plain(panels_page_get_title($panel)) . ')';
    }
    return $return;
  }
  if ($op == 'export') {
    panels_page_load_include('write');
    $code = "/**\n";
    $code .= " * Implementation of hook_default_panel_pages()\n";
    $code .= " */\n";
    $code .= "function " . $name . "_default_panel_pages() {\n";
    foreach ($panels as $panel => $truth) {
      $code .= panels_page_export($all_panels[$panel], '  ');
      $code .= '  $pages[\'' . check_plain($panel) . '\'] = $page;' . "\n\n\n";
    }
    $code .= "  return \$pages;\n";
    $code .= "}\n";
    return $code;
  }
}