Skip to main content
Add module to control form modes
Source Link
4uk4
  • 101.7k
  • 7
  • 173
  • 217

In drupal 8 there are new display modes. They are not only to view the node (view mode). They are also for the node add form (form mode).

For example to change the node add form of the content type article you go to:

/admin/structure/types/manage/article/form-display

Here you can select which fields you want to show and how they are formatted (field widgets). You can make more adjustments with php in form alter hooks or with twig in templates.

By default you have one form mode for each content type. You can create more if you go to the admin interface of display modes:

/admin/structure/display-modes

If you want to use different form modes for different users you can use this module:

Form mode control

Readme:

WHAT FOR ?

Form Mode Control allows you to use the form modes for any bundle / entity, per role and for edition / modification. Which means using different forms (fields, order, widgets, etc.) for different roles.

HOW TO USE IT ?

A - DEFAULT FORM MODES

1 - You must at first add form mode for content entities. Ex. : go to "www.your-site.com/admin/structure/display-modes/form/add" to add a new form mode.

2 - Activate the form mode for the related bundle of the right entity. Ex.if we want to activate a form mode named Super 2 (machine name = super_2) for an article (entity type : Node, Bundle : Article). Go to www.your-site.com/admin/structure/types/manage/article/form-display and activate it.

3 - Go to www.your-site.com/admin/people/permissions, a section named Form modes control was added for all form modes activated (and only activated), So , configure all permissions and give roles permissions to access form modes. NB, the permission Access all form modes allow you to access to all form modes linked to bundle and entity type.

4 - Then configure on the Form mode control administration page (www.your-site.com/admin/structure/display-modes/form/config-form-modes) and give for each role a default form modes for creation / edition (of course, each role must have access to the form mode). B - ACCESS DIRECTLY FORM MODES You can also use it with a simple extra query in the URL (?display=machine_name_of_the_form_mode) if the role is allowed to see it. Of course, the user must have the right permission for it. Ex. : if you want to access to super_2, go www.your-site.com/node/add/article?display=super_2.

In drupal 8 there are new display modes. They are not only to view the node (view mode). They are also for the node add form (form mode).

For example to change the node add form of the content type article you go to:

/admin/structure/types/manage/article/form-display

Here you can select which fields you want to show and how they are formatted (field widgets). You can make more adjustments with php in form alter hooks or with twig in templates.

By default you have one form mode for each content type. You can create more if you go to the admin interface of display modes:

/admin/structure/display-modes

In drupal 8 there are new display modes. They are not only to view the node (view mode). They are also for the node add form (form mode).

For example to change the node add form of the content type article you go to:

/admin/structure/types/manage/article/form-display

Here you can select which fields you want to show and how they are formatted (field widgets). You can make more adjustments with php in form alter hooks or with twig in templates.

By default you have one form mode for each content type. You can create more if you go to the admin interface of display modes:

/admin/structure/display-modes

If you want to use different form modes for different users you can use this module:

Form mode control

Readme:

WHAT FOR ?

Form Mode Control allows you to use the form modes for any bundle / entity, per role and for edition / modification. Which means using different forms (fields, order, widgets, etc.) for different roles.

HOW TO USE IT ?

A - DEFAULT FORM MODES

1 - You must at first add form mode for content entities. Ex. : go to "www.your-site.com/admin/structure/display-modes/form/add" to add a new form mode.

2 - Activate the form mode for the related bundle of the right entity. Ex.if we want to activate a form mode named Super 2 (machine name = super_2) for an article (entity type : Node, Bundle : Article). Go to www.your-site.com/admin/structure/types/manage/article/form-display and activate it.

3 - Go to www.your-site.com/admin/people/permissions, a section named Form modes control was added for all form modes activated (and only activated), So , configure all permissions and give roles permissions to access form modes. NB, the permission Access all form modes allow you to access to all form modes linked to bundle and entity type.

4 - Then configure on the Form mode control administration page (www.your-site.com/admin/structure/display-modes/form/config-form-modes) and give for each role a default form modes for creation / edition (of course, each role must have access to the form mode). B - ACCESS DIRECTLY FORM MODES You can also use it with a simple extra query in the URL (?display=machine_name_of_the_form_mode) if the role is allowed to see it. Of course, the user must have the right permission for it. Ex. : if you want to access to super_2, go www.your-site.com/node/add/article?display=super_2.

Source Link
4uk4
  • 101.7k
  • 7
  • 173
  • 217

In drupal 8 there are new display modes. They are not only to view the node (view mode). They are also for the node add form (form mode).

For example to change the node add form of the content type article you go to:

/admin/structure/types/manage/article/form-display

Here you can select which fields you want to show and how they are formatted (field widgets). You can make more adjustments with php in form alter hooks or with twig in templates.

By default you have one form mode for each content type. You can create more if you go to the admin interface of display modes:

/admin/structure/display-modes