You are here

function _panels_page_construct_dynamic_menu_link in Panels 6.2

Helper function to create a menu item for a panel.

1 call to _panels_page_construct_dynamic_menu_link()
panels_page_construct_dynamic_menu_link in panels_page/panels_page.menu.inc

File

panels_page/panels_page.menu.inc, line 301
panels_page.menu.inc

Code

function _panels_page_construct_dynamic_menu_link(&$items, $panel_page, $page_arguments, $type, $weight = 0) {
  $items['menu items'][$panel_page->path] = array(
    'title callback' => 'panels_page_title_handler',
    'title arguments' => $page_arguments,
    // FIXME re-include an access callback/handler system; currently we just use the fallback's. Where there is no fallback... =)
    'page callback' => 'panels_page_render_handler',
    'page arguments' => $page_arguments,
    'type' => $type,
    'weight' => $weight,
    'module' => 'panels_page',
    'file' => NULL,
  );

  // Add individual tab items for each of the per-display differentiated admin
  // editing areas (layout, layout settings, and content) using a static path,
  // then stack them on top of the normal admin wildcard stack using the
  // tab_root and tab_parent menu properties.
  if (!empty($panel_page->arguments)) {
    $path = "admin/panels/panel-page/{$panel_page->name}/edit";
    $admin = array(
      'title' => 'Default',
      'access callback' => 'panels_page_concession_to_borked_tabs',
      'access arguments' => array(
        $panel_page->name,
      ),
      'file' => 'panels_page.admin.inc',
      'page callback' => 'panels_page_edit_alternate',
      'module' => 'panels_page',
      'tab_root' => 'admin/panels/panel-page/%/edit',
      'type' => MENU_LOCAL_TASK,
    );
    foreach ($panel_page->displays as $id => $display_conf) {
      $admin['title'] = $display_conf['title'];
      $items['menu items']["{$path}/layout/{$id}"] = array(
        'page arguments' => array(
          'panels_page_edit_layout',
          3,
          6,
        ),
        'tab_parent' => $admin['tab_root'] . '/layout',
      ) + $admin;
      $items['menu items']["{$path}/layout-settings/{$id}"] = array(
        'page arguments' => array(
          'panels_page_edit_layout_settings',
          3,
          6,
        ),
        'tab_parent' => $admin['tab_root'] . '/layout-settings',
      ) + $admin;
      $items['menu items']["{$path}/content/{$id}"] = array(
        'page arguments' => array(
          'panels_page_edit_content',
          3,
          6,
        ),
        'tab_parent' => $admin['tab_root'] . '/content',
      ) + $admin;
    }
  }
}