I have a content type with a lot of fields. End users need to create content of this type, so I want to provide them with a simplified form so that they can create a content item and edit it without knowing about the majority of the options. Then those who want to dive into the complexity could have an advanced form which exposes them.

View modes looked like the kind of thing I'm trying to do, so I used hook_entity_info_alter to create a custom view mode and started trying to figure out how to control the view mode used by node/add/my-content-type. After digging into the code I've realised that view modes are used by node_view and that adding or editing a content item uses drupal_get_form instead.

Is there some "form mode" which allows different field type and grouping configuration for different "views" onto a form?

  • I was playing around with d8 the other day and noticed that this is baked into core. Maybe investigate how they did it and see if there is a way to backport it. Commented Aug 12, 2013 at 15:48
  • 2
    you could use the same form by putting the advanced options in a collapsed fieldset, or you could do a form_alter() based upon any number of options, the first that comes to mind is something keyed off node/#/edit?advanced=yes or similar.
    – Jimajamma
    Commented Aug 12, 2013 at 15:55
  • Flexiform + Page manager/Panels is indeed a good solution. See how I achieved it with that project in this issue
    – Kojo
    Commented Jul 3, 2015 at 12:49
  • 1
    In Drupal 8, form modes are in core (drupal.org/node/2511722).
    – user5072
    Commented Feb 1, 2016 at 1:30

6 Answers 6


1 - Panels/Page Manager

If you're using Panels and Page Manager (part of Chaos Tools) then you can break up the node/add form by enabling/overriding the node_edit page manager handler and creating a Panels layout to show the individual fields.

Just set a variant to only react on creation of your particular content type, and then arrange the form fields as you wish. This will let you split out any form fields, as well as provide a General form pane that will add any fields that you've missed out.


Something I didn't realise due to the fact that I always put the general form on the page, is that if you DON'T output ALL fields, then "form api will interpret it as "the user deleted the content of those fields" and will send back empty values. This could result in the loss of existing data, so be careful.

2 - Solely Fields/Field contrib

You could also try Field Permissions if the form is permissions based, or use a Field group with some collapsed fieldsets or tabs etc to initially hide the fields if they are not permission based.

  • It must, unfortunately, always be mentioned in this context, that while Panels happens to let you output only half the form as well, that is not supported by form api. Don't do it. There should probably be validation requiring the entire form to be placed, but no-ones gotten around to it.
    – Letharion
    Commented Oct 30, 2013 at 9:48
  • @Letharion Do you mean that if you miss out some fields, then you MUST add the General form pane as well?
    – Chapabu
    Commented Oct 30, 2013 at 9:50
  • 1
    Yes, one way or another, every field must be present. If not, form api will interpret it as "the user deleted the content of those fields". In theory Panels could re-inject the current information again along the way, but that's significant work that no-ones is willing to undertake. Please consider adding this information into you answer to avoid people loosing their precious data. :)
    – Letharion
    Commented Oct 30, 2013 at 11:38
  • @Letharion Done :) I didn't realise that because I always put the general form pane on (for when I invariably forget to add a field.
    – Chapabu
    Commented Oct 30, 2013 at 11:47

There are several options I believe could work for you....




  • The first one of those looks almost perfect, but it doesn't seem to work for me. The video indicates that it has some bugs, and I seem to be running into more. Something to watch, though. Commented Aug 13, 2013 at 9:21
  • Using panels alone, you should be able to modify the edit page... This might be helpful expresstut.com/content/… This link too nodeone.se/sv/node/711 Commented Aug 15, 2013 at 0:21

The flexiform module can provide this feature for you. http://www.drupal.org/project/flexiform


A partial solution, which is good enough for me at present but doesn't properly deal with things like entity references, is to "borrow" a view mode's configuration in hook_form_alter.

function MODULE_form_FORM_ID_alter(&$form, &$form_state, $form_id) {
  // Since this is specific to FORM_ID, I don't need to extract the entity type
  // from the form / form_state
  $type = 'the_entity_type';
  $view_mode = custom_logic_here();
  foreach (array_keys($form) as $key) {
    $instance = field_read_instance('node', $key, $type);
    if (isset($instance['display']) &&
        isset($instance['display'][$view_mode]) &&
        $instance['display'][$view_mode]['type'] === 'hidden') {

I believe "form modes" were added to D8 core a few months back.

There is no direct equivalent to view modes for form editing in Core.

Generally, you would use form alters to modify forms in D7.

  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
    – Mołot
    Commented Oct 30, 2013 at 8:42
  • 1
    well, it does answer the question. No, there is no equivalent in D7 because it was recently added to D8. You could emulate something "like" view modes for forms, but its not something that exists officially in D7. Commented Oct 30, 2013 at 11:33
  • @Mołot would you consider removing your downvote from my answer? The question is clearly asking for a yes/no response, and the correct answer is "no". Using Panels to hack up forms like this is sort of hacky and is not a straight equivalent of view modes for forms. Commented Feb 9, 2014 at 11:22

You can use https://www.drupal.org/project/form_mode_manager to use form mode implemented in core D8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.