Panels 2 allows you to override the Node Edit Form. Why would you want to do that? Let's say, for example, you need to see all the comments on a node when you are editing it, and you also want the taxonomy editor on the right. Panels 2 allows you to configure the node edit form to be just the way you need it. 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 taxonomy editor as well as node comments.

  1. Make sure you've got Panels 2 installed
  2. Click Panel pages (Administer > Panels > Panel pages). At the top of the page, there are some tabs: click the 'Add' tab, which will bring you to a selection of possible panel layouts. Let's select a 'Two Column' panel.
  3. Set the Panel name to: override_node_edit
  4. Set the Page title to: Edit
  5. Set the Path to: node/%/edit
  6. Click next.
  7. From the tabs at the top, click 'Context'.
  8. In the arguments select list, select 'Node edit form' from the drop down menu and click 'Add argument'.
  9. A window will pop up; find the heading 'Node types' and 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. If your main content type that you want to change is not called 'Story', substitute the other name for 'Story' from this step on.
  10. Press save at the bottom of the popup, and then save at the bottom of the page.
  11. Select the 'Content' tab at the top.
  12. On the left side, click the plus sign. A window should again pop up. Under the 'Form' heading, select 'General Form'. If you wish to restrict access to a specific user type, this window will allow you to (if you don't click any user types, access will not be restricted). Let's just click 'Add pane' for now. This inserts your standard node edit form onto the left half of the panel.
  13. On the right side, click the plus sign. A window should again pop up. Under the 'Form' heading, select 'Node form categories'. This adds a taxonomy editor onto the right side.
  14. Let's add the comments now. On the right side, click the plus sign again. Under the 'Node context' field, select 'Node comments'. Again, if you wish to restrict access, this window is the place to do that, but let's just click 'Add pane' for now. This inserts the comments on the node onto the right half of the panel.
  15. Save your panel.
  16. To test out the panel, go to some content, and click the 'Edit' tab at the top (the one you would normally click). Voila, Panels 2 has overridden the Node edit page!
  17. To create different edit form panels for different content types, you have to repeat step #8 and create two arguments (or however many content types you would like to override the form for). You should end up with arguments listed as "Node edit form," "Node edit form 2," etc. Each argument should be assigned to a different content type. You can also assign one argument to several content types but that's totally up to you. When editing each argument, make sure the content type(s) is checked in both "Node types" and "Own display."
  18. Click Save and go to the "Content" tab. There should be new tabs there and also in "Layout" and "Layout settings."

If you comprehend the steps above, you can skip the manual labor and import the panels, using the import tab at the top:

$page = new stdClass();
$page->pid = 'new';
  $page->name = 'override_node_edit';
  $page->title = 'Edit';
  $page->arguments = array (
    0 => 
    array (
      'name' => 'node_edit',
      'default' => 'ignore',
      'title' => '',
      'id' => 1,
      'identifier' => 'Node edit form',
      'keyword' => 'node',
      'argument_settings' => 
      array (
        'types' => 
        array (
          'story' => 'story',
          'panel' => 0,
          'page' => 0,
        ),
        'own_default' => 0,
        'displays' => 
        array (
          'story' => 0,
          'panel' => 0,
          'page' => 0,
        ),
      ),
    ),
  );
  $page->contexts = array();
  $page->relationships = array();
  $page->access = array();
  $page->path = 'node/%/edit';
  $page->css_id = '';
  $page->css = NULL;
  $page->no_blocks = '0';
  $page->menu = '0';
  $page->menu_tab = NULL;
  $page->menu_tab_weight = NULL;
  $page->menu_title = NULL;
  $page->menu_tab_default = NULL;
  $page->menu_tab_default_parent_type = NULL;
  $page->menu_parent_title = NULL;
  $page->menu_parent_tab_weight = NULL;
$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->pid = 'new-1';
  $pane->panel = 'left';
  $pane->type = 'form';
  $pane->subtype = 'node_type';
  $pane->access = array();
  $pane->configuration = array (
    'context' => 'argument_node_edit_1',
    'override_title' => 0,
    'override_title_text' => '',
    'css_id' => '',
    'css_class' => '',
  );
$display->content['new-1'] = $pane;
$display->panels['left'][0] = 'new-1';
$pane = new stdClass();
  $pane->pid = 'new-2';
  $pane->panel = 'right';
  $pane->type = 'node_form';
  $pane->subtype = 'taxonomy';
  $pane->access = array();
  $pane->configuration = array (
    'context' => 'argument_node_edit_1',
    'override_title' => 0,
    'override_title_text' => '',
    'css_id' => '',
    'css_class' => '',
    'id' => 'taxonomy',
  );
$display->content['new-2'] = $pane;
$display->panels['right'][0] = 'new-2';
$pane = new stdClass();
  $pane->pid = 'new-3';
  $pane->panel = 'right';
  $pane->type = 'node_comments';
  $pane->subtype = 'comments';
  $pane->access = array();
  $pane->configuration = array (
    'context' => 'argument_node_edit_1',
    'override_title' => 0,
    'override_title_text' => '',
    'css_id' => '',
    'css_class' => '',
    'mode' => '4',
    'order' => '2',
    'comments_per_page' => '50',
  );
$display->content['new-3'] = $pane;
$display->panels['right'][1] = 'new-3';
$page->display = $display;
$page->displays = array();

Comments

l0calh0rst’s picture

Neither node/%/edit or node/%node/edit are valid paths. Cannot be used.

ximo’s picture

You're using Panels 3 I suppose? Panels 3 has default pages for these paths that you may use and alter to your liking.

Joakim Stai – Kollegorna

susmitasaha’s picture

I am not sure whether there is any problem with my installation ....
But the steps described here ... is not available to me ...

1. After clicking Administer > Panels > Panel pages I am getting a form & there is no "Add" tab.
Only local images are allowed.
2. If I check the Context checkbox, then on clicking it is showing Context page where from the dropdown I can choose Node Edit form.
3. But on clicking add context button it is asking for the node id, not the node type.

Can you please guide how can I get the content type drop down here?

Thanks in advance for any suggestion.

kopeboy’s picture

How to override node/add only?

sisko’s picture

Are there workable instructions for Drupal 7?

I've been trying to enable the Node add/edit form in the Panels pages area. But, I get the following message:
Page manager module is unable to enable node/%node/edit because some other module already has overridden with workbench_moderation_node_edit_page_override.

I would appreciate any help.

kaztur’s picture

How can I set default value on some form elements independent from manage fields settings?

Skype: kaztur.ru
Phone: +7 917 871 09 85