'Browse available tokens' link does not work

Created on 4 October 2023, over 1 year ago
Updated 3 January 2024, over 1 year ago

Problem/Motivation

When clicking the Browse available tokens link on the easy email type form, the token modal either does not appear or takes a very long time to appear. The logs indicate that loading the token tree fails with an out-of-memory error.

Steps to reproduce

Click the Browse available tokens link on the easy email type form.

Proposed resolution

Stop changing #recursion_limit to 6 and keep the default of the token module, which is 3. Using the default limit, the modal loads, but with a limit of 6 it doesn't.

πŸ› Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

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

Merge Requests

Comments & Activities

  • Issue created by @dieterholvoet
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Status changed to Needs review over 1 year ago
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • πŸ‡ΊπŸ‡ΈUnited States zengenuity

    I understand the issue here, but I'm not sure this is a universal problem. I think it could be dependent on your particular site configuration. I tested this on a couple of production sites where I have Easy Email running, and the token popup was fine. It loaded somewhat slowly but in a reasonable time.

    The reason I extended the recursion_limit is that the nature of the email templates is that you're often going to need to access an entity reference field on the email entity, then down to the entity, then let's say you have another field on that entity, you can't go any further. Specifically, I've been using this for Commece order email receipts, and if the recursion limit is 3, you can get anything beyond the order level field data. That's probably good enough for many things, but not necessarily all.

    I'm not sure I want to globally change this at this point. If there's an easy way to make it configurable somehow, I would definitely be open to that, though I'm not sure where we'd put it. We don't have a global settings page currently.

  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I tested this on a couple of production sites where I have Easy Email running, and the token popup was fine. It loaded somewhat slowly but in a reasonable time.

    If it's already loading slowly for you, all you need is a couple more modules providing global tokens (we have ECK Site Settings β†’ for example) and maybe slightly different PHP timeout settings to make it break. I understand it's more useful to have deeper token depth for some users, but if it means other users can't use tokens at all I'm not sure it's worth it.

    I may have found a good solution. I added a form element to both forms, allowing the user to override the tree depth. What do you think?

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States zengenuity

    Yes, this solution is good. However, it doesn't work when I first load the form. If I click Browse Available Tokens right after loading the form, it seems like token depth is 1. If I change the depth value, it works after that, and the depth is correct. Can you check the initial loading issue?

  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    Fixed!

  • Status changed to Needs review over 1 year ago
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Waiting for branch to pass
  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States zengenuity

    This looks good. I updated the default depth to 4 for both forms, and I reworded the help text to make it a bit more clear what adjusting this value will do. Then I merged the MR.

    Thanks for your work on this!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024