I would think for the most-use cases where the token tree is used, there is only one textfield where it makes sense to insert tokens and it seems unnecessary to force users to click on it, before entering a token.

This small patch achieves that by defining a '#insert_target' property for the token tree.
I personally think it makes sense to move '#click_insert' into an array which holds multiple properties such as this one, #918892: Allow users to disable the 'scroll to textfield' when clicking a token in the tree UI, and I'd like to also have things like the caption message configurable, retain focus after click insert, etc.
That in the end is not for me to decide, though, and I'll comply and reroll whatever the wanted approach is.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tstoeckler’s picture

Oops. Now the patch.

tstoeckler’s picture

Assigned: Unassigned » tstoeckler

Assigning to me.

Chris Matthews’s picture

Assigned: tstoeckler » Unassigned
Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 8 year old patch to token.js, token.module and token.pages.inc does not apply to the latest token 7.x-1.x-dev and if still applicable needs reroll.

Checking patch token.js...
Hunk #1 succeeded at 48 (offset 31 lines).
Checking patch token.module...
error: while searching for:
      'file' => 'token.pages.inc',
    ),
    'token_tree' => array(
      'variables' => array('token_types' => array(), 'global_types' => TRUE, 'click_insert' => TRUE, 'show_restricted' => FALSE, 'recursion_limit' => 4),
      'file' => 'token.pages.inc',
    ),
  );

error: patch failed: token.module:121
error: token.module: patch does not apply
Checking patch token.pages.inc...
error: while searching for:
    $table_options['attributes']['class'][] = 'token-click-insert';
  }

  return theme('tree_table', $table_options);
}

error: patch failed: token.pages.inc:94
error: token.pages.inc: patch does not apply
Andrew Answer’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.52 KB

Patch re-rolled.