Missing options to edit Label and Machine name for a container

Created on 11 February 2024, 6 months ago
Updated 12 March 2024, 5 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 than I add a new container but there no option to edit label or machine name. They are assigned automatically.

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 or edit the existent one.
  4. There is no options to change the label or machine name (by creating a new container).
  5. By saving the container the laben an machine name have been added automatically.

Proposed resolution

Add fields to be able to edit the label and machine name (by creating a new container)

User interface changes

  • A new field label
  • A new field machine name
πŸ› Bug report
Status

Needs review

Version

2.0

Component

User interface

Created by

πŸ‡©πŸ‡ͺGermany juagarc4

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

Comments & Activities

  • Issue created by @juagarc4
  • πŸ‡ΊπŸ‡ΈUnited States japerry KVUO

    This is by design. The machine name and label are auto-generated because requiring users to create them is an additional unneeded step. Is there a reason why they needed to be edited specifically?

    Note -- if there is a need to change them, it can be done manually with the config entity. Since they really shouldn't be changed by end users, I'd suggest going this route instead of changing the UI.

  • Status changed to Postponed: needs info 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States japerry KVUO
  • πŸ‡©πŸ‡ͺGermany juagarc4

    Hi japerry,

    Thanks for the answer.

    Since you can use more containers and more IDs per container, I think it make sense, so that the label and machine name can be used as a kind of categories.

    One use case I have for that right now is the use of this module in combination with Domain. Since I'm using different containers per Domain, it would be useful to put the domain name in the label. In this way is easier to identify what need to be changed, deleted, etc. without having to edit all of them.
    Moreover the use of a customized machine name in the same way of the label would make easier to get information of the container programatically.

    Note: Changing the config entity can be easy done by programmers, but normally the users authorized to change this configuration, don't have the knowledge for that. In this case a change in the UI would be quite appreciated.

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

    IMO, it would be useful to be able to change the Label, but the machine_name should not be possible to be changed. This allows to add more meaningful names to the containers, rather than having to remember the container ids. This behaviour is widely used in Drupal Core, for instance, if you create a content type, then you can modify the label, but the machine_name stays the same.

    There is already a label field in the entity type google_tag_container. So this would only require to add the textfield element in the edit form.
    I will create a issue fork and give it a go, should be fairy easy to do.

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

    I added the label field to the edit form, but i am taking in account the following cases, to avoid disrupting existing workflows and add extra steps when creating a tag container:

    • If the label is left empty, the first tag ID will be used as the label, as before. I added a little description to clarify the behaviour
    • If the label is specified, then this one will be used instead of the first tag ID.

    The machine_name is still generated in the same way, and it cannot be changed.

    I think this would be a great usability improvement for the module, because it allows to add friendly readable names to containers. If you have several containers, it can become complicated to know which is which.

  • πŸ‡©πŸ‡ͺGermany juagarc4

    I'm agree with this approach @guiu. If fact it's not necessary to be able to change the machine name.
    I'll try to test it in the next days.
    Thanks!

  • Status changed to Needs review 5 months ago
  • πŸ‡ͺπŸ‡ΈSpain guiu.rocafort.ferrer Barcelona

    Changing issue status to needs review.

Production build 0.69.0 2024