Custom_elements_ui module: essential enhancements for alpha release

Created on 27 April 2023, over 1 year ago
Updated 11 May 2023, over 1 year ago

Discussed with @fago and compiled list of enhancements and fixes required to tag first alpha release:

  • Check if we can replace ViewDiplay form per display mode if CE is enabled
  • Set default values
  • FIx bug when disable field
  • display other fields on CE form even if they are not configurable on ViewDisplay form (as disabled by default)
  • Check loop error when change formatters
  • etc
πŸ“Œ Task
Status

Fixed

Version

3.0

Component

User interface

Created by

πŸ‡ΊπŸ‡¦Ukraine mostepaniukvm

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

Comments & Activities

  • Issue created by @mostepaniukvm
  • @mostepaniukvm opened merge request.
  • Assigned to fago
  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine mostepaniukvm

    I did implement multiple changes/fixes/improvements. Now custom_elements_ui will be more stable and probably enough to tag the first alpha release on 3.x branch.

    During implementation, I did a summary of changes that will leave here for further discussion. Additionally, there are multiple @todo leftovers in the PR that can duplicate these notes (but better have twice than forget).

    1. Checked briefly but I don't see a straightforward way to replace existing EntityViewDisplayForm routes with custom elements UI form.
    To implement it we probably need to alter route and use our own form that extends the existing EntityViewDisplayEditForm
    Theoretically, it should work but I am afraid to not break the existing View Display Form in case when custom elements UI is not activated for some display modes. Additionally, it will require to extend @internal class EntityViewDisplayEditForm and change form_id. In every method we will have checking like if (!$this->isCeEnabled()) { return parent::method()} As alternative we can move all implementation into hook_form_alter but I don't find it good;
    As an easy solution I added redirect to CE form when user activates it for the first time.

    2. The default value for custom element name is set to [entity_type_id]-[bundle]-[display-mode]
    Or maybe keep it just node as processors do? To work the same after default activation
    For fields' default names we just trim field_ prefix if present

    3. Fix bug when you make field disabled but don't think it is good for a permanent solution.
    The problem is that draggable javascript stopped working when I dropped field formatters.
    As a quick workaround, I just make them not visible to keep js handle rows properly.

    4. Added a fix to unset configuration if you deactivate custom_elements_ui.
    I think would be nice to implement hook_uninstall too.

    5. added changes to show all fields regardless if display is configurable

    6. The infinite loop problem is little more tricky and needs extra discussion. Added temporary workarounds to get it work.

    7. Changed output if "auto" formatter is selected. Probably it related to #3323558: Make configurable Auto option build Custom element same as existing processors do β†’

    @fago Please review PR and you can already test it but let's additionally discuss it

  • Assigned to mostepaniukvm
  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine mostepaniukvm

    We had a productive discussion with @fago and discussed multiple problems. Because of multiple limitations of the current implementation, we decided to make some major changes to make implementation cleaner and easier maintainable in the future.
    We will do implementation in a similar way as implemented in core for entity_view_display and entity_form_display ("Manage display" and "Manage form display" tabs)
    - config: core.entity_ce_display.ENTTIY.BUNDLE.yml
    - toggle in Manage-display just controls whether we take over default entity rendering
    - Manage-custom-elements config always applies when using the CE-generator for the entity and view-mode

  • Status changed to RTBC over 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine mostepaniukvm

    It will be better to finish with this issue and continue working on this newly created issue:
    https://www.drupal.org/project/custom_elements/issues/3359601 πŸ“Œ custom_elements_ui: re-implement with new concept Needs review

    @fago
    Changes in this issue I still consider as an improvement to the existing implementation that we have in 3.x branch. It contains multiple minor improvements and fixes a variety of regressions.
    We had a chance to test it briefly during our last discussion thus I set it as RTBC and merge PR to close this issue and continue in a separate follow-up issue.

  • Issue was unassigned.
  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024