Questions tagged [tokens]

Use it for questions related to the Token module, or a similar form of token replacement system. Don't use it for authentication tokens.

224 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
1answer
330 views

Replacing tokens in Newsletter

I'm trying to create a custom template using the Drupal Newsletter module. I need to populate the newsletter with existing content. For this, I think I need to replace a token like [node:nid] in the ...
3
votes
0answers
580 views

Tokens or token types missing name property

I am having issues in tokens, sometimes they stop working and are not available for use. When I browse the tokens only these are available. After I check the status report, I can see the following ...
3
votes
1answer
99 views

How to escape a string so it does not get replaced by Token::replace()

I have a string that is being sent into the replace method of the token service that looks like a token, but it is not. Here is an example of the string: "['key:value']" Is it possible to escape ...
3
votes
1answer
69 views

Rules scheduled email empty when using php variable, but not when hardcoded

I'm using rules scheduler (on D7) to set up a reminder email based on a time specified within a commerce order (more specifically a line item in the order). I was able to get everything set up ...
3
votes
2answers
3k views

Android submission: I get a “CSRF validation failed” error while using a cookie

The Drupal Version is 7 and the Services version is 3.4. So, My login into Drupal goes like this: Fetch a token. (POST) Fetch a Cookie using the token. (POST) Make GET Requests using ...
3
votes
0answers
738 views

How do I get the current node's parents (using PathAuto and Custom Tokens)?

A url for my site looks something like this: www.mysite.com/best-sellers/mistery/novels/this-is-a-book-title I want to remove "best-sellers" from that chain. I'm using PathAuto to generate my paths. ...
3
votes
0answers
208 views

Is there a way to use tokens in a Views: Link Display setting?

This question pertains to Drupal 7 and Views 3 (specifically 7.23 and Views 7.x-3.7): Is there a way to enable the use of custom tokens within Drupal Views Link Display settings? My use case is a ...
3
votes
2answers
405 views

Custom Path Alias with Initial Letter as Token

For various reasons, I need to change my custom path alias for a taxonomy type as follows... FROM: /composers/aardvark TO: composers/a/aardvark So I'm looking at either creating a custom token, or ...
3
votes
1answer
693 views

Using token in page.tpl.php?

I downloaded the social media module and I found this token: [socialmedia:sm-twitter_username]. I want to show it where the Read more / Add new comment section is, under an article. Since I can't find ...
3
votes
2answers
2k views

Conditional token pattern

I am looking for a module or a hook that allow me to use if conditions with tokens. For example I want to check if a field is equal to a specific value or text [if][field_name][eq]hello[then][...
2
votes
0answers
116 views

Simple OAuth Role assignment within a Scope

I have a web app that has multiple scopes under a single OAuth consumer. I want the user's Drupal role to be used when logging in. In simple OAuth, I have created 1 consumer that has 2 scopes: ...
2
votes
0answers
368 views

Getting [current-page:title] in webform hidden field from panels

Using page manager panels, I created a custom page that populates info taken from several content types. On that page, I have a webform block (created from the original webform content type). I need ...
2
votes
0answers
71 views

How can I pass values to Rules?

I would like to pass values to Rules (eg an array of words) and then do some Rules magic with them (eg create new nodes if they dont exist already). I found one solution here How to reference ...
2
votes
0answers
210 views

Displaying Token Field Labels From Fetched Entity In Rules HTML Email

I am sending a MIME HTML email using rules. Much of the information contained in the email comes from a fetched custom entity (custom ECK entity). Using the available replacement patterns, I can get ...
2
votes
0answers
25 views

Getting a node-uniqe identifier such as node id or path as replacement pattern at node creation

I have a content type which consists of a large text field and a number of file fields. Users are allowed to /node/add instances of this content type and are then expected to upload all relevant files ...
2
votes
0answers
91 views

passing filter to eva view

I watched the eva tutorial listed on the eva project page for drupal 7 and implemented that with our site. We have courses, objectives and evaluation content types. I am successfully able to attach ...
2
votes
2answers
1k views

How do I add a custom field token to a default value?

I want to add node-field data into the web from block via tokes as with Webform 7.x-4.1 this should work. But tokens from custom fields are not available in a webform(block) ? [node:title] and [...
2
votes
0answers
50 views

How do I include the result of a token as a parameter for another (custom) token?

I'm writing a module with custom tokens. I need a token that generates a hash based on three other tokens: user id, poll id and (poll) option id. The idea is that a user gets links to vote by email ...
2
votes
0answers
71 views

What token should I use while sending email when I am programmatically adding the content?

When I fill the form. I get this email A new Event "Event name" has been created. To approve this Event please go to http://websitename.com/content/content-name and click ‘publish’. I have set ...
2
votes
0answers
153 views

D7 Image Field Paths - Using a custom Path for Each Image Style

I am looking to have an image get dynamic name for each style that is generated by the system. Currently I am using tokens to generate an md5 hash for the file name, but for each style (eg small/med/...
2
votes
0answers
1k views

Multi-Valued Field Collection Token Issue

I have a field collection field in a content type that takes multiple values. I am trying to access single values of that field to use via a token. The issue is the following: (the field is called ...
2
votes
1answer
545 views

Rule to send an e-mail with the URL of an uploaded attachment after node change

I have a Drupal 7 site with a custom node type with a custom attachment field. After a (kind of this custom) node has been published, I got an e-mail with the help of Rules module. I would like to set ...
2
votes
0answers
71 views

How to create a views normal menu based on a contextual filter

In drupal7 I can create a views menu and path easily. What I would like to do is create an automatic path and normal menu based on a field [year] that is associated with a specific node type, using a ...
2
votes
1answer
137 views

token_replace : operate on two different 'user' entities?

I've got an e-mail message with the following contents: Dear [receiver:name], [sender:name] would like to recommend the following link [node:url]. Now, I could certainly implement hook_tokens() and ...
2
votes
0answers
3k views

Webform replacements using %post[key] for Array variables

I'm trying to set a default value for a hidden field capturing a POST Array Variable (by the way, webform form keys are arrays) but the literal is not replaced with the posted value. Should I escape/...
2
votes
0answers
240 views

How can I display parent and child terms from a CCK Taxonomy field in Pathauto?

How can I have two (or more) different taxonomy vocabularies appear in my Pathauto settings at the same time? For example, if I want to use the 'location' vocabulary and the 'accommodation type' ...
2
votes
0answers
231 views

Passing a referenced node's location token to referring node

I have two content types -- Invoice and Project -- which are related to each other (Basic content types provided by Storm). Project has a Location CCK field, which I want to use in the Invoice's title ...
1
vote
0answers
18 views

Guidance on entity reference - tokens or token parsing tools suggestions?

I have 3 content types - Organization, Site and Station. Stations related to a Site. Sites related to an Organization. A user can update is 'location' to show where they are working that day. I use a ...
1
vote
0answers
20 views

Token to output the last value in a multi-value field?

I have a text field in an Entityform set to accept an unlimited number of values: I'm trying to build a Rule that sends an email with the text from the last submitted value from the field. The token ...
1
vote
1answer
37 views

Cannot get just the text of an option from submitted data

I'm using Webform 8.x-5.8. I've got a select box referencing some content. Of course, the numeric option value is passed. But when I reference submitted data with tokens, I just want to handle the ...
1
vote
0answers
56 views

Is there any workaround for the “Global Text” area in “No results behavior” that doesn't process chained tokens?

I have a view with a contextual filter for the node ID. If the view returns no result, I would like to display a fixed picture (no problem) linking to a path containing the node ID from the filter in ...
1
vote
0answers
20 views

File (Field) Path settings to rename multiple images with their alt or title

The module File (Field) Path allows me quite nice to rename a single image file with its "alt" or "title". But if allow the image field to accept multiple downloads, I cannot get the individual alt/...
1
vote
0answers
355 views

Set Default Value of User Entity Reference to logged in user

I have a Drupal 8 installation that has a user reference field and I would like the currently logged in user to be the default value for the field. I believe in Drupal 7 I would've used the [current-...
1
vote
0answers
1k views

Get token of image field in paragraph field

We're implementing the Open Graph metatags so that social media shares can know which image to use as the "share" image on our pages. I'm having a problem figuring out the token for a image field URL ...
1
vote
0answers
69 views

Is there a means of setting an alternative or a default for an undefined token?

I am using the nid in combination with other fields to set the title of a node, but as the nid is only defined after the node creation, the initial title has a blank in the nid's place. I have to ...
1
vote
0answers
119 views

Paragraph fields as node tokens in Drupal 7

Is there a Drupal 7 equivalent to [node:field_paragraph:0:entity:field_hero_image]? I'm trying to use an image field in a paragraph as the og:image using the Metatag module, but the only token I can ...
1
vote
1answer
1k views

How to use node field tokens as a value in Metatags module?

I am trying to optimise SEO on my site by ensuring that each page has a unique value for descriptive metatags. I am trying to achieve this using the Token and Metatags modules, and am using Drupal 8. ...
1
vote
0answers
101 views

Token replace for commerce products in rules

I'm trying to create a rule for automatically generating a commerce products titles from all the values of products fields. After each values I need to add suffix like cm, W, kg, mm e.g. In order to ...
1
vote
1answer
41 views

How to place size of file in the node in the title?

I want create page for issues of newspaper. Title of the issue page must contain the issue number, date of publishing and size of newspaper file in MB. I implemented number and date in title with ...
1
vote
1answer
251 views

Edit the token values submitted by webforms

I am using webform for user registration and confirmation page as profile page. I have included the token as follows " [submission:values:name] [submission:values:email] [submission:values:country] [...
1
vote
0answers
175 views

utm in token [current-page:url]

For a specific type of urls on my website I'd like to add an utm on opengaph URL, so I can track social activity on those URLs. The token I'd like to modify is: [current-page:url]. I've tried: [...
1
vote
1answer
68 views

Can I add php code on title of a link?

I have this problem: I created three content types. Actor, author and musician. An user can modify own actor, author and musician profile, if his role is one of these. A user can have more than one ...
1
vote
0answers
54 views

Current Date + 5 days in Date Tokens

[current-date:custom: F, Y] This displays December, 2016 when today's date is 1-31st December, 2016. How can we start showing December, 2016 from last 5 days of November?
1
vote
0answers
35 views

figuring out menu token path for file field

I'm trying to use menu token and file (field) path to get a path to display a node's PDF field from a menu link. I tried with the tokens: [node:field_pdf]/[file:url] with and without relative path ...
1
vote
1answer
368 views

how to use tokens as “views filter criteria” for a custom table?

I created view for fields from a custom table using handlers. I need to create a filter so that only the users who created the data can see the data. how can I create the filter?
1
vote
0answers
1k views

Pathauto aliases won't generate for custom entity types

I have a custom content entity type, mymodule, which currently generates paths like /mymodule/{entity_ID}/ on creation. My entity has a title field defined programmatically in my baseFieldDefinitions(...
1
vote
3answers
282 views

Add field value in the value of another field

I'm sorry about the title (I think it's a bit confused :D) I can explain better what I need to do. I have one product with several fields, among which: title,date, description, price, etc... I would ...
1
vote
0answers
166 views

Render User field in Display Suite custom fields

I am trying to use display suite custom field to show a user avatar field (custom field). In my DS tokens, the field is available as [comment:author:field_user_avatar]. But the field/image does not ...
1
vote
1answer
607 views

How do I filter the current year?

Initially, I have installed the Token module and created a Views block containing years. I want to filter out the current year from the block (it should not show the current year). In filter ...
1
vote
0answers
15 views

Output empty text instead of unevaluated token (in JS Block)

I'm trying to output data through a block using JavaScript for Intercom. Most tokens work fine, but if the source field for the token is blank, the token itself is returned instead of any value. Of ...

1
2 3 4 5