You are here

function panels_panel_context_get_display in Panels 6.3

Same name and namespace in other branches
  1. 7.3 plugins/task_handlers/panel_context.inc \panels_panel_context_get_display()

Get the display for a task handler.

There are three methods that the display can be found.

  • In the database. $handler->conf['did'] will be set in this case, and $handler->conf['display'] won't be.
  • In $handler->conf['display'], with $handler->conf['did'] empty. This will be true for a default/imported task handler as well as a handler that has just been created but has not yet been saved.
  • in $handler->conf['display'] with $handler->conf['did' populated. This simply means that the display has been modified and is awaiting save. The modified one should always be used for editing purposes.
  • If none of the above is true, then a new display needs to be created for the handler and pla
12 calls to panels_panel_context_get_display()
panels_panel_context_admin_summary in plugins/task_handlers/panel_context.inc
Provide a nice little summary of what's in a panel.
panels_panel_context_clone in plugins/task_handlers/panel_context.inc
When a handler is cloned, we have to clone the display.
panels_panel_context_edit_choose in plugins/task_handlers/panel_context.inc
Choose a layout for this panel.
panels_panel_context_edit_layout in plugins/task_handlers/panel_context.inc
Change the layout for this panel.
panels_panel_context_edit_layout_submit in plugins/task_handlers/panel_context.inc
A layout has been selected, set it up.

... See full list

File

plugins/task_handlers/panel_context.inc, line 217
This is the task handler plugin to handle attaching a panel to any task that advertises itself as a 'context' type, which all of the basic page tasks provided by page_manager.module do by default.

Code

function &panels_panel_context_get_display(&$handler) {
  if (isset($handler->conf['display'])) {
    return $handler->conf['display'];
  }
  if (isset($handler->conf['did'])) {
    $handler->conf['display'] = panels_load_display($handler->conf['did']);

    // Check for a valid display. If no valid display can be loaded, something
    // is wrong and we'll create a new one.
    if (!empty($handler->conf['display'])) {
      return $handler->conf['display'];
    }
  }
  $handler->conf['display'] = panels_new_display();
  return $handler->conf['display'];
}