Drupal 8/9 to get a text from a URL in the Twig Template
Example 1: Set a 'pageurl' variable to contain the current page URL, and then look for a 'discount' string in the 'pageurl' variable, which means in the URL; if the string is present, the <p> tag data will be printed.
Example 2: Set the value of the 'node.field link.0.url' field to a 'linkurl' variable. and we're looking for the '/node/add' string. If this exists, the data will not be displayed; otherwise, the link 'Read More' will be displayed.
Example 2: Set the value of the 'node.field link.0.url' field to a 'linkurl' variable. and we're looking for the '/node/add' string. If this exists, the data will not be displayed; otherwise, the link 'Read More' will be displayed.
Share
share your add link
https%3A%2F%2Fmycode.blog%2Flakshmi%2Fdrupal-89-get-text-url-twig-template%0A
Share in social
Comments