Stack Exchange Network

Stack Exchange network consists of 175 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
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

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.

2
votes
1answer
17 views

Drupal hash salt / private key is changing?

I've created a token that I store in database, here is how I create my token : $token = drupal_hmac_base64($pid . " " . $order_id . " " . $solde, drupal_get_private_key() . drupal_get_hash_salt()); ...
0
votes
2answers
50 views

Switch between View Modes from the URL

Under the manage display for the user profile /admin/config/people/accounts/display, I have 4 view modes as below: Default Profile (Machine name: user.profile) Company (Machine name: user.company) ...
0
votes
1answer
42 views

Programmatically using values from a loaded entity inside a message

I am using Firebase module to send push notifications to a specific mobile user when a webform is submitted. Below is my custom webform handler: <?php namespace Drupal\my_custom_module\Plugin\...
0
votes
1answer
47 views

Let 'web-view' mobile iOS/Android app talk consume/feed site

I have a Drupal 8 site with the following modules: HAL. HTTP Basic Authentication. REST UI. RESTful Web Services. Serialization. Using the REST UI module, I configured it as follows. Settings for ...
0
votes
0answers
22 views

Pulling Custom Content Type field value into a token

I need to create a custom token for a custom content type in Drupal 8. there is a field, e.g 'field_image' I'm trying to use Token Custom module to pull the value of the filed and into the token. ...
1
vote
1answer
55 views

Set a date field equal to “current time” + “5 minutes” using tokens

I am using the Field Timer module to display countdown timer on my article node. Say my article node has the date/time field named (field_article_datetime) This module will take the value of the ...
1
vote
1answer
28 views

How do I create a jump link to a paragraph item?

I'm trying to create a jump link to the paragraph item. This is what I tried create a compact display of the page just printing out a title and short summary. using the advanced text formatter I ...
0
votes
0answers
18 views

SocialMedia module is not replacing [socialmedia:sm-twitter_username] when sharing to Twitter

When I use the SocialMedia Twitter button, it opens a new window which displays: As you can see, the [socialmedia:sm-twitter_username] token is not being replaced. In the user's profile, there is a ...
0
votes
1answer
33 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
31 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
35 views

Pass node tokens to a webform on a paragraph?

Drupal 8.6.5 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
18 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
119 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
26 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
71 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
19 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/...
1
vote
1answer
69 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
36 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
19 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
94 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
102 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
77 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 ...
2
votes
1answer
198 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
34 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
45 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
271 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
226 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
68 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
237 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
233 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
199 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, ...
2
votes
1answer
250 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
419 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
68 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
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 ...
0
votes
1answer
43 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
53 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
61 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
675 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
140 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
155 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
25 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
52 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
247 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
18 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
36 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
20 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 ...