Missing options to order containers by weight

Created on 11 February 2024, 10 months ago
Updated 22 February 2024, 10 months ago

Problem/Motivation

I recently updated a project from Drupal 8.9 to Drupal 10. The old versions used the old version of Google Tag Manager module and the new one uses now Google Tag 2.0.2. I enabled the option to create multiple containers and when I tried to order them using the weight I couldn't find the option like in other listing pages to order items by weight.
Moreover there is no option to adjust the weight by editing the item.

Image attached to see the current status.

Steps to reproduce

  1. Enable the module Google Tag
  2. Enable the option "Allow multiple Tag Containers" on the Advanced Tab under settings: admin/config/services/google-tag/settings
  3. On the Tab "Additional Tags" create another container (it should exists already one container main)
  4. After creating the second container, the column weight is visible but there is no option to order items by weight (usually it's possible by drag and drop or by displaying the weights using a link on the top of the table
  5. Edit the item you want to change the weight for but you can't find any option to change the weight

Proposed resolution

  • Add an option to change the weight on the item's edit form.
  • Add the option to show weight on the top of the table.
  • Add drag and drop possibility to order the items like in other listing pages.

User interface changes

  • A new link on the top of the table to show the items weight.
  • A drag and drop possibility to reorder the items.
  • A new option on the edition form to change the weight of the item.
πŸ› Bug report
Status

RTBC

Version

2.0

Component

User interface

Created by

πŸ‡¨πŸ‡­Switzerland juagarc4

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

Comments & Activities

  • Issue created by @juagarc4
  • πŸ‡¨πŸ‡­Switzerland juagarc4
  • First commit to issue fork.
  • πŸ‡ͺπŸ‡ΈSpain guiu.rocafort.ferrer Barcelona

    guiu.rocafort.ferrer β†’ made their first commit to this issue’s fork.

  • πŸ‡ͺπŸ‡ΈSpain guiu.rocafort.ferrer Barcelona

    I changed the TagContainerListBuilder class to extend DraggableListBuilder, and adapted the buildHeader and buildRow methods for the new class. For this to work, i had to add "weight" to the TagContainer entity annotation entity_keys.

    I am not sure if the weight field in the edit form is really necessary, since it can be changed in the list already.

    I am not complete sure, but i think we should write a hook_update, to clear the related caches for the entity type and force Drupal to pick up the changes from the annotation. I tried manually clearing caches, and seemed to work well. "config:google_tag_container_list" might be a good candidate for a cache tag to invalidate in that hook.

  • πŸ‡¨πŸ‡­Switzerland juagarc4

    I tested today the new functionality and it works like a charm.
    It worked even without clearing the caches and I don't think either, the weight field in the edit form is really necessary.

    Thank you very much :-) !!

  • πŸ‡¨πŸ‡­Switzerland juagarc4

    I tested today the new functionality and it works like a charm.
    It worked even without clearing the caches and I don't think either, the weight field in the edit form is really necessary.

    Thank you very much :-) !!

  • Status changed to RTBC 10 months ago
  • πŸ‡¨πŸ‡­Switzerland juagarc4
Production build 0.71.5 2024