You are here

function PanelizerEntityNode::get_default_display in Panelizer 7.3

Same name and namespace in other branches
  1. 7.2 plugins/entity/PanelizerEntityNode.class.php \PanelizerEntityNode::get_default_display()

Provide a default display for newly panelized entities.

This should be implemented by the entity plugin.

Overrides PanelizerEntityDefault::get_default_display

File

plugins/entity/PanelizerEntityNode.class.php, line 81
Class for the Panelizer node entity plugin.

Class

PanelizerEntityNode
Panelizer Entity node plugin class.

Code

function get_default_display($bundle, $view_mode) {
  $display = parent::get_default_display($bundle, $view_mode);

  // Add the node title to the display since we can't get that automatically.
  $display->title = '%node:title';

  // Add the node links, they probably would like these.
  $pane = panels_new_pane('node_links', 'node_links', TRUE);
  $pane->css['css_class'] = 'link-wrapper';
  $pane->configuration['build_mode'] = $view_mode;
  $pane->configuration['context'] = 'panelizer';

  // @todo -- submitted by does not exist as a pane! That's v. sad.
  $display
    ->add_pane($pane, 'center');
  unset($pane);

  // If the content type is enabled for use with Webform, add the custom
  // submission pane.
  if (module_exists('webform')) {
    if ($view_mode == 'page_manager') {
      if (variable_get('webform_node_' . $bundle)) {
        $pane = panels_new_pane('entity_field_extra', 'node:webform', TRUE);
        $pane->configuration['context'] = 'panelizer';
        $pane->configuration['view_mode'] = 'full';
        $display
          ->add_pane($pane, 'center');
        unset($pane);
      }
    }
  }

  // Add a custom pane for the book navigation block for the Page Manager
  // display.
  if (module_exists('book')) {
    if ($view_mode == 'page_manager') {
      $pane = panels_new_pane('node_book_nav', 'node_book_nav', TRUE);
      $pane->configuration['context'] = 'panelizer';
      $display
        ->add_pane($pane, 'center');
      unset($pane);
    }
  }
  return $display;
}