Hi guys,

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.

While reviewing module's code, I found out Page Title is using Token and more particularly calling token_tree on the Page Title admin settings form page:
in page_title.admin.inc, line 61:

<?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:

In particular, looking at #1684984: Support opening token browser in a jQuery UI dialog on demand, it seems some major improvements have already been committed 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, #1684984-17: Support opening token browser in a jQuery UI dialog on demand, 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 #1684984-16: Support opening token browser in a jQuery UI dialog on demand), 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.

 

Comments

Status:Active» Needs review

Changing status for review.

Thanks very much in advance.

Issue summary:View changes

Added more information: Reference to Meta Tags module.

Issue summary:View changes

Updated issue summary: changed a word/language.