Drupal Association members fund grants that make connections all over the world.
I just wanted to report a small area of improvement I spotted where we could add very little code but an interesting feature to the module. I tried to look for this in module's tracker, but this feature request doesn't seem to have been raised before.
<?php $form['token_help']['content'] = array( '#theme' => 'token_tree', '#token_types' => array('node', 'comment', 'term', 'vocabulary', 'user'), ); ?>
It seems that there has been a lot of on-going work and initiatives towards improving the token browsing methods, UI, performance and user experience:
- Token API changes for Drupal 7
- Probably some more posts.
In particular, looking at fb05b22 on July 14, 2012.
Concretely speaking, it would mean that since token-7.x-1.2 (August 10, 2012), the token tree list could leverage the new browser UI features provided by Token.
Referring to post from Dave Reid,, I was wondering whether it would be possible to support the token browser by adding a single line to the existing code, mentioned above:
<?php $form['token_help']['content'] = array( '#theme' => 'token_tree', '#token_types' => array('node', 'comment', 'term', 'vocabulary', 'user'), + '#dialog' => TRUE, ); ?>
I have tested simply adding
'#dialog' => TRUE, to the current content form element, it seems to be working fine and allows displaying the expected Browse available tokens link (which opens the token tree in the browser dialog window).
In this case (token-7.x-1.2 or greater version), I'm not certain the wrapping fieldset (Available Tokens List, displayed on Page Title admin settings form page) would still be needed, but I would assume it should probably not be removed to keep the compatibility with older versions of Token.
We might as well want to add some code there to check the version of the token module (maybe something along the lines of what is suggest by DamienMcKenna, see ), but I thought it would probably need further consideration and more discussion/feedback.
Another good example for this feature could be found in the Meta Tags module, in metatag.module, line 846.
Please find attached to this ticket a patch against the latest page_title-7.x-2.7+1-dev (2012-05-11) to add basic support for new Token 1.2 popup browser.
[File attached as: page_title-support-token-ui-browser-0.patch]
Could you please let me know if I overlooked or missed anything in the current Page Title or Token modules (and their APIs), in terms of whether this feature request would be reasonable?
Please let me know if you would have any questions on any points/code/aspects mentioned in this ticket, I would surely be glad to provide more information.
I would greatly appreciate if you could take a bit of time to look into the patch and give me your feedback/opinion on this feature request.
Any feedback, reviews, testing, changes, recommendations would be highly appreciated.
Thanks to all in advance.
|Patch to add support for Token UI Browser for versions from token-7.x-1.2 and above.||484 bytes||DYdave|