What is a “link template” in a token?
Question
When configuring a webform submission URL by using tokens, I noticed this entry that specifies a link template:
[webform_submission:url:?]
The URL of the webform submission. Replace the '?' with the link template. Defaults to 'canonical' which displays the submission's data.
What is a link template? Can I customize or define my own? How would I know what other tokens can be used in place of 'canonical'?
Solution
Link templates are defined in the entity class. For webform_submission:
* links = {
* "canonical" = "/admin/structure/webform/manage/{webform}/submission/{webform_submission}",
* "access-denied" = "/admin/structure/webform/manage/{webform}/submission/{webform_submission}/access-denied",
* "table" = "/admin/structure/webform/manage/{webform}/submission/{webform_submission}/table",
* "text" = "/admin/structure/webform/manage/{webform}/submission/{webform_submission}/text",
* "yaml" = "/admin/structure/webform/manage/{webform}/submission/{webform_submission}/yaml",
* "edit-form" = "/admin/structure/webform/manage/{webform}/submission/{webform_submission}/edit",
* "notes-form" = "/admin/structure/webform/manage/{webform}/submission/{webform_submission}/notes",
* "resend-form" = "/admin/structure/webform/manage/{webform}/submission/{webform_submission}/resend",
* "duplicate-form" = "/admin/structure/webform/manage/{webform}/submission/{webform_submission}/duplicate",
* "delete-form" = "/admin/structure/webform/manage/{webform}/submission/{webform_submission}/delete",
* "collection" = "/admin/structure/webform/submissions/manage/list"
* },
Source: https://git.drupalcode.org/project/webform/blob/8.x-5.x/src/Entity/WebformSubmission.php
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange