When you add a token tree table to a form and use #states to hide / show them then this doesn't work because the table does not have a js-form-item class.

When you do this in your form then it does work:

      $element['token_tree'] = \Drupal::service('token.tree_builder')->buildRenderable($entity_types, ['global_types' => FALSE]);
      $element['token_tree']['#attributes']['class'][] = 'js-form-item';

Is there a reason why the token tree table does not have the form-item and js-form-item class?

Comments

Johnny vd Laar created an issue. See original summary.

Dave Reid’s picture

Status: Active » Fixed

Because it's not a form item? If you need to use #states I would suggest putting the token tree inside of a container element.

Status: Fixed » Closed (fixed)

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