Created
May 20, 2022 01:06
-
-
Save rvizena/2f32c28643c162f640916e0a60c25335 to your computer and use it in GitHub Desktop.
Drupal 9: require the exact URL from the link reference field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You might be using a link field on your entity type, and if so, you might find yourself in a position where you require the exact URL from the link reference field. | |
{{ content.field_custom_link.0['#url'] }} | |
If you need the title, use this instead: | |
{{ content.field_custom_link.0['#title'] }} | |
Be sure to switch out the bolded text above for the machine name of your custom link field. | |
source: https://createdbycocoon.com/knowledge/get-url-or-title-link-field-drupal-twig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment