Allow to use entity form mode instead of configuring widget in views

Created on 22 January 2023, over 1 year ago
Updated 23 January 2023, over 1 year ago

Problem/Motivation

I would like to have ability to edit entities of different bundles with different widgets (or different widget settings). I my case I have 2 types of products, one must have only integer quantity value while another one can have decimal quantity value. It all can be done with modules commerce and commerce_stock, 2 bundles of product variation and different settings for stock level field widget on each product variation. But it works only on edit forms. Module views_entity_form_field doesn't consider different bundles but applies same widget settings to all widgets in view.

Proposed resolution

Allow to select form view mode for entity form field in views

✨ Feature request
Status

Needs review

Component

Code

Created by

πŸ‡·πŸ‡ΊRussia sergei_brill

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sergei_brill
  • @sergei_brill opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Hello sergei_brill , I would like to test your patch but not sure how to reproduce it.

    Can you be so kind and provide steps ?

  • πŸ‡·πŸ‡ΊRussia sergei_brill
    1. You need 2 bundles of entity type. It can be 2 node types: article and page.
    2. Configure form display for default form mode for each node type so, that it has different settings for the same field (for example, different widgets for Author).
    3. Create new custom form mode for nodes at /admin/structure/display-modes/form.
    4. Configure form display for the form mode from point 3 for each node type so, that it has different settings for the same field.
    5. Create node entries of each node type.
    6. Create a view listing nodes of all the types. The view must display fields from the point 2 and 4 (it can be the same field, actually) as editable.
    7. In the settings of the editable field in view select default form mode and save view. The view with nodes has to have different widgets for different node types. The widgets has to correspond to default form display (see point 2).
    8. In the settings of the editable field in view select form mode created in point 3 and save view. The view with nodes has to have different widgets for different node types. The widgets has to correspond to form display with this form mode (see point 4).
Production build 0.69.0 2024