Enable Gin edit form for Commerce Product

Created on 17 February 2023, almost 2 years ago
Updated 30 August 2024, 4 months ago

Problem/Motivation

Commerce product and variations add/edit forms has a different layout from content edition, which makes hard for regular users to maintain the content. Hold main sticky actions on top and additional element on sidebar helps users to work better in content maintenance.

Steps to reproduce

Create new commerce product.
Edit any commerce product.

Proposed resolution

Apply new Gin layout to commerce product and variations add/edit forms.

โœจ Feature request
Status

Needs work

Version

3.0

Component

Code

Created by

๐Ÿ‡ช๐Ÿ‡ธSpain dtamajon

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

Comments & Activities

  • Issue created by @dtamajon
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland sokru

    $route_names array need also following to support translations:

    'entity.commerce_product.content_translation_add'
    'entity.commerce_product_variation.content_translation_add'
    
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia mrinalini9 New Delhi

    Updated patch #2 by addressing #3, please review it.

    Thanks!

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States paul121 Spokane, WA

    This makes me wonder if this wouldn't be desirable for other commerce sites. Your reasoning does make sense to me but I'm just thinking more generally. Could Gin make these gin content forms configurable via a setting in the UI? In addition to allowing other modules to specify this in a hook?

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

    @paul121

    Could Gin make these gin content forms configurable via a setting in the UI?

    Not in the UI, and weโ€™re not planning in introducing lots of new settings to our UI โ€“ but thatโ€™s actually already possible via hook_gin_content_form_routes().

  • First commit to issue fork.
  • @parisek opened merge request.
  • Status changed to RTBC 11 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nicolasgraph Strasbourg

    The only thing that is kind of weird is the blank sidebar on product variations, but I guess we can't do much here about that. Maybe an issue could be created in commerce to add some more informations there.

  • Updated patch #4 for version 3.0-rc10.

  • Status changed to Needs work 5 months ago
  • ๐Ÿ‡ญ๐Ÿ‡บHungary pasqualle ๐Ÿ‡ญ๐Ÿ‡บ Budapest

    By default Gin theme should only care about core functionality. Everything else should be easily configurable or extendable.

    In this case you can do this as:

    /**
     * Implements hook_gin_content_form_routes().
     */
    function mymodule_gin_content_form_routes() {
      return [
          'entity.commerce_product.add_form',
          'entity.commerce_product.edit_form',
          'entity.commerce_product_variation.add_form',
          'entity.commerce_product_variation.edit_form',
          'entity.commerce_product.content_translation_add',
          'entity.commerce_product_variation.content_translation_add',
      ];
    }
    

    or move the issue to commerce to make sure all commerce forms work correctly with Gin theme.

  • ๐Ÿ‡ฆ๐Ÿ‡นAustria mvonfrie

    I understand that Gin should care only about core as there are tons of contrib modules which might need to adapt themselves to Gin as well, which would bloat the module to handle all or even many of them. On the other hand, should all those contrib modules be aware of Gin and maybe other themes which need adjustments of he modules to work with them? That's the same problem just from the other side.

    What about a more generic approach, like the Gin everywhere โ†’ module does? It even enables Gin for some core forms which are not covered by Gin itself (Block Content, Media, Menu). Why not integrating Gin everywhere completely into Gin?

    And additionally, please document it better how to enable Gin for your own custom entity type. At least put a section in the project documentation which points to the proper hooks in the gin.api.php. Thanks.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nicolasgraph Strasbourg

    By default Gin theme should only care about core functionality. Everything else should be easily configurable or extendable.

    So I guess this should be removed : https://git.drupalcode.org/search?search=commerce&nav_source=navbar&proj...

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

    @nicolasgraph why would we want to remove the icon? These are two completely different things

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nicolasgraph Strasbourg

    @saschaeggi, I'm just saying that if, as @Pasqualle said "By default Gin theme should only care about core functionality.", which is a completely admissible argument, I guess the commerce icon should not be embed by default. Is it used when Commerce is not installed ? The fact that this icon is there by default could be interpreted as a Commerce support, and thus, justify issues like this one.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nicolasgraph Strasbourg

    Thanks @hydra, I can live with a custom hook for now, but i'll give gin_everywhere a try.

Production build 0.71.5 2024