The module allows tokens to be used as arguments for the view. Right now it's hard to know what tokens are available. I have tried a few things, but I can't really seem to get it to work. Could you give some clear instructions about that? Better yet: include it in the interface of the module, just like Views does.

Thanks.

Comments

a.ross’s picture

I have found this list of tokens. I hope my find will help others.
Anyway, my request still stands. A simple instruction would do for now, I can do the patch for that.

Eventually it would be great though, if some rules-type token selection was written for this module.

simon georges’s picture

a.ross’s picture

The admin/help/token page is more user friendly and shows every token that is available on your site.

bleen’s picture

+1

robeano’s picture

When you enable the token module and the devel module, you can see the available tokens for a node by clicking the Devel tab, then the Tokens local task (below the tabs).

When you implement these tokens, you need to copy the whole token for example [node:title]. Now, edit your View:

* go to Admin -> Structure -> Views
* click Edit for your view
* click the Entity Content display you have created
* click the Arguments value (this link is labeled 'ID', 'none' or 'Token') in the Entity content settings section (it's in the middle column in the view's configuration)
* If you want tokens, then select either:
* Use the ID of the entity the view is attached to (select this option if you want the ID to be a filter on the view)
OR
* Use tokens from the entity the view is attached to (use this when you want tokens but no filtering by the ID)
* Now you can paste that token into the text field below those radio buttons
* click Apply
* If you haven't done so already, you need to add Context to your view so it can take the token and apply it to the view to filter the results.
* Save your view

Things to watch out for: Don't add Filters -> add Context to your view in order to use tokens via eva.

joachim’s picture

Component: User interface » Documentation
Category: feature » bug

Missing documentation is a bug.

At the very least a link to online docs at http://drupal.org/node/390482#drupal7tokenslist would help show people what to do here.

zambrey’s picture

Title: Available tokens » Provide list of available tokens
Component: Documentation » User interface
Category: bug » feature
Status: Active » Needs review
StatusFileSize
new2.81 KB

Here's the patch that displays list of available tokens for selected entity.
Token module must be enabled in order to make it happen.
Please test & mark as RTBC when everything is working as advertised.

joachim’s picture

StatusFileSize
new1.88 KB

I've cleaned the patch up a bit -- code style and there were a couple of unrelated changes.

7wonders’s picture

patch applied nicely and functioning properly

joachim’s picture

Status: Needs review » Reviewed & tested by the community

That sounds like an RTBC to me. Thanks for testing! :D

dave reid’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/eva_plugin_display_entity.incundefined
@@ -66,6 +66,13 @@ class eva_plugin_display_entity extends views_plugin_display {
+    if (module_exists('token')) {
+      // We must load token values here to show them on the options form.
+      drupal_add_js(drupal_get_path('module', 'token') . '/token.js');
+      drupal_add_css(drupal_get_path('module', 'token') . '/token.css');
+      drupal_add_library('token', 'treeTable');
+    }

Why is this necessary? The theme_token_tree() should automatically include this?

+++ b/eva_plugin_display_entity.incundefined
@@ -125,11 +132,32 @@ class eva_plugin_display_entity extends views_plugin_display {
+            '#global_types' => TRUE,
+            '#click_insert' => TRUE,
+          );

These two variables are the default values. They are redundant and uncessary.

zambrey’s picture

Status: Needs work » Needs review
StatusFileSize
new1.81 KB

Thanks for review Joachim and Dave!
@joachim yeah, I forgot to mention that I did few minor unrelated tweaks to code.
Thanks for fixing comments, I'm not good at that.
@Dave I also thought that it will be included automatically but seems that these libraries must be loaded before you enter plugin configuration page which is loaded by ajax callback. You can try to visit that page without this fragment and see what happens. I'm not expert in JS so maybe there is another way to force libraries to load without this condition.
In any case, here's another patch without default values pointed in #11.

pasqualle’s picture

drupal_add_css() and drupal_add_js() does not work with ajax load..

rwilson0429’s picture

@robeano, #5: Support is 'good to know' and very good step-by-step documentation. It was especially helpful tip that we shouldn't add filters but, use context instead. That makes sense. Thank you, robeano.

valderama’s picture

for people who are currently struggling with how to pass tokens as arguments this page might be helpful also:
http://drupal.org/node/1299662

If you need to pass the term_id of a taxonomy reference field, you can specify a token like this [node:field_mytermref], and on the manage display page you need to modify the token view_mode and tell the reference field to output the term_id - you need a custom formatter for that, either you code own or you use this module http://drupal.org/project/custom_formatters

hth!

akamaus’s picture

Status: Needs review » Reviewed & tested by the community

I've been struggling with passing two token arguments to eva display. After applying patch #12 problem solved instantly. It's a real time saver! Hope to see it merged soon.

mkadin’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Looks good, super helpful. Committed to the dev branch, look out for a new release soon.

aaronbauman’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new481 bytes

On sites with a substantial number of available tokens, this new feature freezes the browser completely.

Can we implement the new token modal support?
#1684984: Support opening token browser in a jQuery UI dialog on demand

mkadin’s picture

I'm glad to see that the token people have worked on a solution to this. I HATE visiting the node type edit page because it takes 30 seconds to load.

That being said, this dialog rests on top of the views modal which rests on top of the overlay...the UI is tough.

Can we think of any way to make this less ugly? I'd rather have a functional token option and an ugly UI than a non functioning token option.

If you have so many tokens that the browser crashes, does not do it with the new dialog? Or does the dialog allow you to avoid rendering the token tree (by not clicking on the link)? If its the latter, maybe we can pull the tree in via ajax within the existing modal instead of using the dialog.

joachim’s picture

Status: Needs review » Needs work

> On sites with a substantial number of available tokens, this new feature freezes the browser completely.

For me it freezes JS, and Firefox then asks me whether to stop the script. If I do, then make changes and try to save the options, I'm taken to a page of AJAX source.

Tried the patch. Opening the token modal still gets me a Firefox 'stop script' popup.

Clicking a token (once the list appears) gets me an alert 'First click a text field to insert your tokens into.' which I can't do because I'm in a modal with just the tokens.

It's at least an improvement in that if you don't use tokens, your view doesn't crash :)

mkadin’s picture

Status: Needs work » Needs review
StatusFileSize
new9.86 KB

What do we think of this? This replaces the tree with a link that pulls the tree in via ajax.

Need at least one person to test this bad boy out, I want to make sure:
1) on a site with a crazy number of tokens, you can still access this setting (as long as you don't click the ajax link).
2) On a site with a normal amount of tokens, the tree is successfully pulled in.

simon georges’s picture

Why not use the new (since Token 7.1) theme function of the Token module, allowing something similar (see #1684984: Support opening token browser in a jQuery UI dialog on demand)?

mkadin’s picture

That was proposed and discussed in 18 and 19 above...the query UI dialog doesn't work well over the existing views UI dialog.

simon georges’s picture

Hum... sorry about that. Sure. Maybe in D8 ;-)

dave reid’s picture

I don't understand how #21 is any better or maintainable than supporting the dialog option in Token.

mkadin’s picture

StatusFileSize
new8.52 KB
new274.65 KB
new264.87 KB

It was purely a UI thing. Its funky to deal with a jQuery UI dialog over a ctools modal popup on top of the overlay module. Also, clicking on the tokens in the UI dialog makes the ctools modal window do some strange things (like resize?) I've attached screenshots of the two.

Also attached is a reroll of the patch that actually applies cleanly to the latest dev.

rcodina’s picture

Issue summary: View changes
Status: Needs review » Closed (fixed)

This is done on 7.x-1.2 which I'm using. So issue closed.