Overriding the node edit form

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!

Panels 2 allows you to override the Edit form of a node. The advantage is clear for developers and non-developers as well, as placing difference blocks in different places is all made through an easy to use UI.

Let's override the Edit form of all the story nodes and divide it into two columns. On the left will place the content form, and on the right the node comments.

  1. In the panel settings 'Add' a 'Two Column' panel.
  2. Panel name = Override node edit
  3. path = node/%/edit
  4. Click 'next'
  5. On the top tabs select the 'Advanced'. Don't worry if you're not advanced, its pretty simple.
  6. In the arguments select list, select the 'Node edit form' and click 'Add argument'
  7. On the JavaScript window that opens enable the checkbox next to 'Story'. This means the panel will grab (i.e. override) all the nodes edit form of the story content type.
  8. In 'Own display' select also the story. This will make sure, that later if you wish to create a different panel for different content type, your life will be easier. If you wish all content types to look the same, skip this operation.
  9. 'Save' the JavaScript, and 'Save' on the bottom of the page!
  10. Select the 'content' tab.
  11. If you didn't skip operation 8, under it you will notice under set of tabs: 'Default' and 'Node Edit 1 form'. Select the 'Node edit 1 form'
  12. Add content to the left panel, and the right. Let your imagination and geekness lead your way – on the 'Form' you have all the basic elements of the Edit node form. On the right add the node comments.
  13. Save your panel
  14. Create a story node and submit it
  15. Edit the node – viola, panels has overridden the Edit form

For the lazy among you, you can import the panels:

$page = new stdClass();
$page->pid = 'new';
  $page->name = 'Overidenodeedit';
  $page->title = '';
  $page->arguments = array (
    0 =>
    array (
      'name' => 'node_edit',
      'default' => '404',
      'title' => '',
      'id' => 1,
      'argument_settings' =>
      array (
        'types' =>
        array (
          'story' => 'story',
          'page' => false,
        ),
        'own_default' => '',
        'displays' =>
        array (
          'story' => 'story',
          'page' => false,
        ),
      ),
    ),
  );
  $page->contexts = array (
  );
  $page->access = array (
  );
  $page->path = 'node/%/edit';
  $page->css_id = '';
  $page->css = '';
  $page->no_blocks = '0';
  $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';
$display = new stdClass();
$display->did = 'new';
$display->name = NULL;
$display->layout = 'twocol';
$display->layout_settings = NULL;
$display->panel_settings = NULL;
$display->content = array();
$display->panels = array();
$pane = new stdClass();
  $pane->panel = 'left';
  $pane->type = 'form';
  $pane->subtype = 'node_type';
  $pane->access = array (
  );
  $pane->configuration = array (
    'context' => 0,
    'override_title' => 0,
    'override_title_text' => '',
  );
$display->content['new-1'] = $pane;
$display->panels['left'][0] = 'new-1';
$pane = new stdClass();
  $pane->panel = 'right';
  $pane->type = 'node_comments';
  $pane->subtype = 'comments';
  $pane->access = array (
  );
  $pane->configuration = array (
    'context' => 0,
    'override_title' => 0,
    'override_title_text' => '',
    'mode' => '4',
    'order' => '1',
    'comments_per_page' => '50',
  );
$display->content['new-2'] = $pane;
$display->panels['right'][0] = 'new-2';
$page->display = $display;
$page->displays = array();
  $page->displays['argument_0-story']['title'] = 'Node edit form 1 Story';
  $page->displays['argument_0-story']['argument_id'] = '0';
    $display = new stdClass();
    $display->did = 'new';
    $display->name = NULL;
    $display->layout = 'twocol';
    $display->layout_settings = NULL;
    $display->panel_settings = NULL;
    $display->content = array();
    $display->panels = array();
    $pane = new stdClass();
      $pane->panel = 'left';
      $pane->type = 'node_content';
      $pane->subtype = 'content';
      $pane->access = array (
      );
      $pane->configuration = array (
        'context' => 0,
        'override_title' => 0,
        'override_title_text' => '',
        'link' => 0,
        'teaser' => 0,
        'page' => 1,
        'links' => 1,
        'no_extras' => 0,
        'identifier' => '',
      );
    $display->content['new-1'] = $pane;
    $display->panels['left'][0] = 'new-1';
    $pane = new stdClass();
      $pane->panel = 'right';
      $pane->type = 'node_comments';
      $pane->subtype = 'comments';
      $pane->access = array (
      );
      $pane->configuration = array (
        'context' => 0,
        'override_title' => 0,
        'override_title_text' => '',
        'mode' => '4',
        'order' => '1',
        'comments_per_page' => '50',
      );
    $display->content['new-2'] = $pane;
    $display->panels['right'][0] = 'new-2';
  $page->displays['argument_0-story']['display'] =  $display;

Panels

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: