Remove hardcoding #group for the status field

Created on 11 April 2024, 7 months ago
Updated 18 September 2024, about 2 months ago

Problem/Motivation

When creating a custom entity, the status field can be not only a boolean type, as in node. This leads to the fact that when gin is enabled on the form for editing this entity, it looks bad.

Steps to reproduce

- Create a custom entity with a status field with a type other than boolean (for example, select)
- enable the gin edit form for the new entity
- go to the page for creating/editing an entity (see image)

Proposed resolution

configure the group only if it is a checkbox type, for example, a quick solution in GinContentFormHelper.php:

      // Assign status to gin_actions if it input is checkbox.
      $widget_type = $form['status']['widget']['#type'] ?? 'checkbox';
      if ($widget_type === 'checkbox') {
        $form['status']['#group'] = 'gin_actions';
      }

Remaining tasks

- create a mr to solve the problem
- test with different types of status field (select, entity_reference, etc.)

๐Ÿ“Œ Task
Status

Needs review

Version

3.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @Maks Oleksyuk
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pradhumanjainOSL

    pradhumanjain2311 โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Success
    7 months ago
    Total: 186s
    #157765
  • Status changed to Needs review 7 months ago
  • Status changed to Postponed: needs info 5 months ago
  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland saschaeggi Zurich

    Can you please test this with what we're working on in โœจ Move Action buttons to sticky header Fixed ?

  • Status changed to Needs work 5 months ago
  • tested it on the dev version with the suggested changes from โœจ Move Action buttons to sticky header Fixed
    nothing has changed (I also noticed that the sidebar switch is hidden in the ellipsis, it seems it shouldn't be like that)

  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland saschaeggi Zurich

    @maks

    tested it on the dev version with the suggested changes from #3356717: Move Action buttons to sticky header
    nothing has changed

    Okay thanks for verifying

    (I also noticed that the sidebar switch is hidden in the ellipsis, it seems it shouldn't be like that)

    That is intentional

  • First commit to issue fork.
  • Pipeline finished with Failed
    5 months ago
    Total: 272s
    #211250
  • Status changed to Needs review 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States paul121 Spokane, WA

    We have experienced this same issue in farmOS for some time where the entity status field is not a checkbox. I solved it in other ways (our own version of GinContentForm so to say) but agree with the proposed fix to only move the status when it is a checkbox.

    Furthermore, I'm running into this issue on *simple forms* (not entity forms, not gin content forms) after โœจ Move Action buttons to sticky header Fixed . With this change and status field in a form is moved out of the form to the actions area. Not only is this unexpected, but it also results in this status field not being included in the form submission (I believe because the status is moved without the additional template changes that content forms receive?)

    I think the fix is two parts:
    1. Only move the status field on gin content forms
    2. Only move the status field when it is a checkbox

    I've opened a new MR with these changes. It also includes some changes to simplify GinContentFormHelper logic and also likely increase performance (don't invoke thegin_content_form_routes hook multiple times!!!)

  • Pipeline finished with Success
    5 months ago
    Total: 218s
    #211260
  • Pipeline finished with Success
    about 2 months ago
    Total: 258s
    #286618
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States paul121 Spokane, WA

    I've rebased this MR onto the latest 8.x-3.x, there was only one minor conflict with the last commit with this MR. Still need a review on this

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Maninders

    Not able to Replicate this issue on my local.

Production build 0.71.5 2024