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.

Filter by
Sorted by
Tagged with
0
votes
0answers
11 views

How to get a dynamic delta token in a multi-value field via views

Here’s the situation… I have a multi-value PHOTOS field in views. The image ALTs are all unique. These photos are output into a slideshow, and I’m building a custom caption for each slide (photo) by ...
0
votes
1answer
16 views

How to print token in webform-confirmation.html.twig?

I would like to output a submitted value as a token on the confirmation page through the twig. The token works just fine when added into the message box of webform as: [webform_submission:values:...
0
votes
1answer
15 views

Token does not return full dynamic path to Media Image URL

I'm having trouble configuring Metatag for Open Graph and Twitter Card images. I'm using Drupal 8.9 core Media Image reference field as the source. [node:field_hero_image] (Entity reference field) ...
0
votes
1answer
17 views

Help with URL argument token

I'm trying to use tokens in the Linked Field module to link a field in one content type to another content type. I'm also using Pathauto. So I want to link a field in URL /type/subtype/pagetitle to ...
0
votes
0answers
11 views

How can I combine a confirmation mail, especially text for [simplenews-subscriber:combined-url] in simplenews?

I would like to custom link for the [simplenews-subscriber:combined-url] which appears as http://example.org/newsletter/combined/123/123456789..... It would be better if the link appears as Subscribe ...
2
votes
0answers
54 views

How do I test for an empty Address webform element?

Using Drupal 9.1.3 : Webform 6.0.0 How to check for the null value of a Webform Address Composite element {% if webform_token('[webform_submission:values:**ELEMENT_NAME**]', webform_submission, [], ...
2
votes
0answers
33 views

How do I get a view to list nodes that have the same detail in a particular field as the current node?

Using D8, I'm putting together a genealogy site for my family and having a hard time creating a block that lists the brothers and sisters of the Person being displayed. The basic unit of the site is ...
-2
votes
2answers
24 views

Custom token not being replaced

In my_module I have the following: function my_module_token_info() { $info = []; $info['types']['my_module_tokens'] = [ 'name' => 'My Module Tokens', 'description' => t('Tokens ...
0
votes
0answers
14 views

I can't get the token from /rest/session/token

I'm trying to get CSRF token in http://mydomain/rest/session/token and I didn't get anything. When I put http://mydomain/session/token I got one token, is it the same token I should get in rest/...
0
votes
1answer
31 views

How to load certain old submission value into webform?

I collect data in a web form. As one of the first fields, it has a dropdown with which it selects a certain ID. Later on, there shall be grouped elements like this: value_old | value_new | diff ...
0
votes
0answers
33 views

Webform submission value as date field default

I need to populate a webform date field with the value of another date field. Here’s the yaml: copied_birthdate: '#type': date '#title': 'Birthdate' '#help_title': 'Birthdate Format' '#help': ...
2
votes
2answers
36 views

Pass User object to Token::replace

I've the following code (sample) that runs on Cron and sends SMS to users. $token = \Drupal::token(); $message = Hey, [current-user:account-name]; $message_value = $token->replace($message); ...
0
votes
1answer
41 views

Token path to file URL, filename, etc.?

I'm writing a Rule that sends an email when a user uploads a file to a node. How would I output the file's URL and filename in the body of the email? First, some things to note: This is an Entityform ...
0
votes
1answer
27 views

Is there a plain-text equivalent to the 'html' suffix for [webform_submission:values]?

I've written a Drupal 8 webform handler plugin that sends webform submission data to another server via REST. I'm trying to send all the populated fields of the form to the third-party server so that ...
1
vote
1answer
74 views

Replace a word in a custom block or paragraph with a token related to a content type field value

I have a content type with a mix of paragraphs and custom blocks. Most custom blocks (content) are the same on all pages except for one word that needs to be replaced by an other one. I would like to ...
3
votes
1answer
100 views

Webform submission token for multivalue download field

I'm trying to setup a webform that sends links which can be accessed to download a file. It's working with the first file already, but I can't figure out how to create the token for the other files ...
0
votes
1answer
30 views

Is there a token for the cron token?

For internal use by editors I would like to get cron link into a custom menu, but I need to do this dynamically, such that it can used across multiple sites. Editors do not have access to Admin ...
1
vote
0answers
23 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
31 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
51 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 ...
0
votes
1answer
143 views

Token for user being viewed

I am formatting the user profile page in Drupal 8.9.2. Are tokens available for the user being viewed (in user profile page), to display the user information? I am using the Token and the Token Filter ...
0
votes
0answers
12 views

In the D8/D9 webforms module, what is the correct sytax to rename an uploaded file using tokens?

I am building a webform. I have a name Field that uses first and last name. I have an image upload field where I want to rename the image to lastname-firstname.jpg. In the properties for the file ...
0
votes
1answer
54 views

Webform token formatting

I'm trying to get the answers from one form, pre-filled in another form by adding tokens in the confirmation URL. This works for most answers while using the token: [webform_submission:values:?] ...
0
votes
0answers
31 views

Token support on the menu link field

Is there is any alternative way to make token to work in the Drupal 8 menu link field other than Menu Token module. I want to use token to set as a default value when I am creating new menu, but if I ...
0
votes
0answers
99 views

How to get URL on Computed Twig field (with tokens)

I have a Computed Twig field created on my webform. (Using webform module). In the "Computed value/markup" I have entered the value "{{ uri }}" token, and the url is correctly ...
0
votes
1answer
44 views

Tokens missing in Webform Emails after upgrading

Currently running Drupal 7.69 / PHP 7.3 (+ CiviCRM) I have recently updated some Modules : Webform, Views Bulk Operations, i18n, and Content Access. Since then, my Webform Emails do not show the ...
0
votes
0answers
28 views

Menu token not working sometimes

I am using /user/[current-user:uid]/edit to generate the user profile setting page where user can edit there profile. Sometimes it works and sometimes it displays the wrong user id and sometimes I get ...
0
votes
0answers
21 views

Formatting labels of Webform2PDF for submissions

How would I go about changing style for all the labels for pdf generated from submissions to a webform. I could explicitly state each [submission:values:email:label] and then provide values with ...
1
vote
1answer
24 views

Tokens in field widget don't work

I am using drupal 8. I want to add tokens to the paragraph image field widget as data-attribute, but it doesn't work. What can be caused by this problem? Is it need some modules? Here screenshot: ...
1
vote
0answers
60 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 ...
0
votes
1answer
73 views

How to get taxonomy tree with path auto token?

I'm using Path auto module to automatically set url of articles. Last part of url is node title and [node:title] works just fine. But url part before node title should follow taxonomy structure (tree) ...
0
votes
2answers
58 views

Custom tokens breaking on node save with “node entity cannot have a URI” error

I'm getting a crash on node save when my node contains a custom token. I'm using the Token Filter module to display tokens in node content. To make the tokens I followed this tutorial, which is ...
1
vote
0answers
24 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/...
0
votes
1answer
100 views

CKEditor strips all inline CSS and some tokens

I'm trying to add a color and font size to some text using the CKEditor. As soon as I save it these are stripped out. I've also noticed some tokens are stripped down when certain settings are enabled. ...
0
votes
2answers
203 views

Can't get token replacement to work

I have nearly this exact case but as it applies to Drupal 8: Store token replacement values in the database rather than tokens themselves). I have a content type 'article' with a 'body' field ...
0
votes
1answer
27 views

How do I use Taxonomy reference field tokens in a path alias?

I have a content type with two taxonomy entity reference fields. Both are required fields that only allow one value. I have path_auto and token enabled. I would like to use them to set the path of the ...
0
votes
0answers
22 views

Include multiple profiles per user in webform data

I have a profile type that allows multiple profiles per user. Users have different numbers of profiles. I'm trying to include this variable profile data in webform submissions tied to the profile(s)-...
0
votes
0answers
6 views

Find multi-value field that has X or more values

I have a multi-value field that needs to change to a single value field. Changing the cardinality doesn't work because there are some instances that have more than one value. How do I find those ...
0
votes
1answer
52 views

How to get replacement pattern for Search API's fulltext search in global text area header

In Drupal 7, I'm currently using the default core search, and a view for node search results. I have a global text to pull in the replacement pattern for the term that were searched for. I get the ...
0
votes
1answer
25 views

Token Filter module to work on Menu URL and Title

menu_token module is working fine to achieve the purpose. Does the module token_filter has this functionality? I can use tokens in wysiwyg using token_filter but cannot make it working for menu title ...
0
votes
0answers
24 views

Conditional re-write result depending on type

Drupal 8 I have a view that outputs search api results from several sources. One of these are some media types. I wish to conditionally rewrite the result depending on the media type. ...
1
vote
1answer
29 views

More information than standard “Site Details”, also to be available as tokens [closed]

Is there a way to add additional fields to the config/system/site-information area such as business owner, "business location", "hours of operation", "phone number", etc. I would then like to be able ...
1
vote
1answer
89 views

How to set an exposed filter to enable current user to view nodes that he has not commented

On my D7 site I am trying to create an exposed filter where current users would choose whether he wants to see all nodes, or only those that current users have not commented. Tried adding 'Comment: ...
0
votes
1answer
359 views

Get the user's current language code

How can I get the user's current language code in a view as a raw value, for example en or fr-ca? This isn't for filtering content. I need the raw value of the users' current language to pass into a ...
0
votes
1answer
39 views

How do we replace the token <front> in a custom module?

I am using the following in my custom module but the token is not being replaced. Is this a namespace issue? $token_service = \Drupal::token(); $post_login = $token_service->replace('<front>'...
0
votes
2answers
35 views

How to change the value of a commerce token?

When an order is submitted on our D7 site an email is sent to us with all the details of the order, including the payment method. I use the token [commerce-order:payment-method] in the commerce email ...
0
votes
0answers
26 views

Current page title token doesn't change when going to multiple pages

I have a block where I want to include a token of the current page Title. But it's either caching or locking up after the first page. In a sidebar there's a block where I've tried two things: 1. "...
0
votes
1answer
32 views

New Relic shows the token hook being called a lot

I've just installed NewRelic on a Drupal 7 website, and I'm now going through the most obvious issues that jump out at me. Looking at the Drupal specific menu items, I notice the "Token" module ...
0
votes
0answers
40 views

getting the translated version of current url token

In D8, with the usual translation modules enabled, I have a custom pop-up to change language on our site. Currently, it contains a link and text, like this: <p><a href="/en-us[current-page:...
0
votes
1answer
428 views

Format for webform submission node tokens?

I have a field on my webform node which is an entity reference to a taxonomy term. I'm printing it in the webform using the token [webform_submission:node:field_sports], which prints the field output, ...

1
2 3 4 5
14