Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
18 views

How to use tokens in webforms?

I'm trying to use the [current-page:url] token in a webform hidden field (as the default value) but the submission shows "[current-page:url]" literally. Am I missing something?
0
votes
1answer
8 views

How do I use a token to set the default value of a date field to the current date?

When I go to the build tab of the webform and click edit on the date element, I can find the default value setting under the advanced tab in the element editor. The help text says I can use tokens, ...
0
votes
0answers
21 views

Pass node tokens to a webform on a paragraph?

Drupal 8.6.5 with Webform 8.x-5.2-beta1+16-dev I have a webform as a field on a Paragraph. The paragraph is referenced from a node. I need to be able to pass field values from both the node and the ...
0
votes
0answers
17 views

How to token Insert nth element of Iframe?

Module used: Token Insert I have a content type with an iframe field which accepts multiple values. In my wysiwyg body field, I did a token insert. When I add this iframe field which has only one ...
0
votes
2answers
106 views

Print commerce pricing attributes to email receipt

Users cannot see what size or color shirt they purchased in the email receipt because tokens won't print the attribute fields provided by Commerce Product Attributes / Commerce Pricing Attributes / ...
0
votes
1answer
20 views

Programmatically get the continent from ISO2

I am using the Countries module to assign countries and associated data to nodes. I am currently writing a custom token and only can access the ISO2 data for the value, not the associated data (full ...
-1
votes
1answer
53 views

Using node values in a custom token

I'm trying to create a custom token using the Custom Tokens module. The token should use (and modify) a node field value, but it not returning any value. I set the token to need node data and I am ...
0
votes
1answer
18 views

Countries Additional Data Tokens not working

I'm using Pathauto and Countries to build path aliases that reflect the country and corresponding continent of a node. For example if a node's country field is set to Spain the url should be: europe/...
0
votes
1answer
61 views

Update the date field to the date & time of the node being updated

I am sure that I am missing something very simple here, so I hope somebody can put me on the right track. Use Case: I have a simple content type "Article" A date field of type: "Date and Time" is ...
0
votes
1answer
28 views

Get arbitrary user entity with tokens

Is there a way to retrieve an arbitrary user entity via tokens inside a node field? For example: Let's say I have a field name Source, which contains a reference to an external news publication. I ...
0
votes
1answer
17 views

How to access private page (views page) with authentification in the URL?

All the pages of my site are private (by role). I have nodes and views pages. I want to access to a views page with an external link. But, If the visitor isn't logged, this visitor can't access to the ...
0
votes
1answer
34 views

How to get Webform Radio Option Value as a token value for email template?

I am trying to use my webform's radio field to choose between two departments, let's call them ABCDE and XYZ. On the webform display that the user sees, I want them to show up as ABCDE and XYZ. When ...
2
votes
1answer
87 views

How to dynamically redirect user from /foo/X to /bar/X?

So far I did the following: I've installed Redirect and Token modules. I've applied the patch for Redirect module to support wildcards. I've applied the patch for Redirect module to implement ...
1
vote
1answer
47 views

How to find where are defined tokens for Redirect?

After enabling Token and Redirect modules, I've found at /admin/help/token that I can use Redirect tokens. For example: However, I've got the problem finding the place where and how these tokens are ...
3
votes
1answer
99 views

How can I link to a specific comment on drupal.org?

I'm aware that you can use [#1234] syntax in posts on drupal.org issue pages. However, is there any syntax to point to the specific comment, like: [#1234:12]? I was using it before, but I forgot the ...
0
votes
0answers
99 views

Webform submission tokens in emails

I am trying to print the webform submission label and value from tokens in confirmation email. The problem is that the label of the form element is not appearing, only the value. Tried with: [...
1
vote
1answer
27 views

Customize the appearance of sharing articles to social media

I am new to Drupal and I just added a few buttons for sharing articles to social media (Facebook, Twitter etc.) I want to customize the appearance of sharing posts. After a few "research" I found out ...
0
votes
1answer
35 views

Show the ID of referenced entities using tokens, instead of the label with link

I have a content type, Company, which is referenced to a User with an entity reference. The token for that entity reference for the current user is [current-user:field_user_company]. No matter ...
0
votes
1answer
142 views

How to display custom token in custom block

In a Drupal 8 website I created a custom token that is working in basic page. Then I created a custom block with a WYSIWYG field : class Myblock extends BlockBase { public function __construct(...
-2
votes
2answers
124 views

How to display a token in plain text (without link)?

I created a form with the module "Webform" on "Drupal 8". In the form submission email, there is a token: [webform_submission:values:profil:entity:field_personnel_sexe] In the inbox, the term ...
0
votes
1answer
37 views

Possible to have conditional Tokens?

In using URL aliases, is there a way to have conditional token usage? An example of what I'm looking for is: I have programs on my page, each having their own unique program code. By default, say my ...
0
votes
1answer
166 views

How to show different delta of a multi-value token?

I have a multi-value field for user statistics (around 18 INT values): the field field_nurse_patients contains 18 integers 0,5,3,3... Is there a way to get a format like below with tokens? Maybe ...
0
votes
0answers
122 views

Use contextual filter as a token in a view

I have a Drupal 8 site with a view that uses a taxonomy term as a contextual filter. In a block display for this view, we have a custom button, defined in the footer, that links to a page showing the ...
1
vote
1answer
117 views

Metatag images don't work anymore after updating [closed]

I was on Drupal 8.5.x and Twitter cards and Open Graph on Facebook were displaying correctly. After updating to Drupal 8.6.1, the images don't display anymore. The others data (title, description, ...
1
vote
1answer
183 views

Why doesn't the token for the node title work?

In Drupal 8, I activated the Message module and the Message Example sub-module. These are the fields I added to the template to create a message when a new comment is created. This is the ...
1
vote
0answers
295 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 ...
0
votes
1answer
66 views

How to create a message when a new store is created?

I installed the Message module on my site : https://www.drupal.org/project/message And I created a custom module from the Message Example sub-module. Here is the content of the ...
1
vote
0answers
68 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 ...
0
votes
1answer
38 views

How to display the user's image in a Message Template?

I activated the sub-module "Message Example" of the module "Message". I added the token in the "Example - User register" message template : [message:author:user_picture:thumbnail] When a message is ...
1
vote
2answers
45 views

What's the workflow behind [user:display-name] token?

I have seen in an email template, a token named [user:display-name]. Further noted that this token is not global, its value will only get rendered in email templates (correct me if I'm wrong). How ...
0
votes
1answer
44 views

form submitted value as token

I have created a form by extending FormBase class. In form, I'm having a field called "name" where user can input his name. While submitting form, I want that submitted name convert into token so that ...
2
votes
1answer
316 views

Where is the the full tokens list for a site?

In the Metatag module UI it uses tokens but only shows a small list of tokens that are relative to the site information rather than the full content tokens which it can use, in D7 there was an admin ...
0
votes
1answer
86 views

Token for Total Flag Count

I have created a flag for my comments named HELPFUL. If users find a comment helpful they vote it as such. The challenge that I have is how do I show the total votes for the flag next to the button? ...
0
votes
1answer
93 views

How to get the value of a taxonomy term from entity reference using a token?

We have an Entity reference field on Basic Page content type that is set to Articles. The Articles content type has a field, field_category that is a taxonomy term. What is the correct token to get ...
0
votes
1answer
22 views

Can tokens be used to set values of other fields and in modules which use tokens?

I am finding the Metatag module rather unwieldy, and I want to create fields in the content type from which Metatag values will be set. Are there tokens available for the fields of any arbitrary ...
0
votes
1answer
13 views

webform 5 access other webform tokens

Is there a way to access tokens of another webform ? I have users of one role who need to evaluate in a webform files uploaded by users with another webform
0
votes
2answers
23 views

Rewrite results for user picture to except tokens

I have a user role called "Residents" in D7, and created a view the show profile information. I want to add colorbox to the User Picture, but there is only one token available [picture]. How do I add ...
2
votes
0answers
42 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: ...
0
votes
1answer
169 views

can you put views field values into a global token?

Suppose I want to use a paragraph field value of an entity for metatag title (by using metatag views module) I can successfully get the value of the paragraph entity and display it on the view Now, ...
0
votes
0answers
17 views

Modal Webform How To Get Page Title Value

I am using modal forms to display a web form <a class="ctools-use-modal ctools-modal-modal-popup-small callback ctools-use-modal-processed" href="/modal_forms/nojs/webform/122">Get a Call Back&...
0
votes
0answers
34 views

Two different content paths for the same content type with different taxonomy terms

Sorry for the inaccurate title. I have a content type called product display. In product display I use taxonomy terms, 8 different term names, to categorize the different products. However, I have ...
0
votes
0answers
17 views

Custom created tokens are not replacing values when used in Rules->Action as email receiver

I'm trying to assign values from my custom created token called [custom:email] as the email receiver in Rules under Actions->Elements->Send Mail Following is described how I'm trying to achieve ...
0
votes
0answers
14 views

How to reuse a field value via token in another field within a form

In the form at node/add/article I want to use the current value that the user enters in Field A and Field B and use it in the core Title Field. Of course, there are handy modules like Automatic ...
1
vote
0answers
51 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 ...
0
votes
2answers
87 views

Drupal 8 Page Cache

I am using dynamic tokens in page title, which is always being cached. I want to stop that. I have try by disabling page cache using function hook_preprocess_page(&$vars) { $vars['#cache']['...
0
votes
1answer
410 views

How to Logout user with Basic auth?

I can log in, perfectly fine, but can't get logout to give me a JSON response. Currently, I can only do POST to d8.com/user/logout?csrf_token=123&?_format=json and that would log out, even ...
0
votes
0answers
99 views

change output of [webform_submission:values] token

By the default, the [webform_submission:values] token is replaced by the following HTML code in HTML emails: <b>Field title:</b><br /> field value<br /> <br /> <b>...
0
votes
0answers
57 views

How to reference field in custom token

I'm struggling to understand how to reference a field value in a custom token for Drupal 8. I want the token to use in the Automatic Entity Labels plugin. Basically, I just want the token to wrap a ...
0
votes
0answers
45 views

Load field from node id into webform hidden field in drupal 8

I have a staff directory view that passes the node id to the contact form in the url when you click a button, but I am having a problem with loading the associated email field into the email_to hidden ...
0
votes
1answer
58 views

How to add global variable/token to use site wide

My phone number exists many places like block, node body, view, etc. Currently, I enter my phone number all the places. If I migrate it to another site and phone number changes, I manually have to ...