Showing posts with label how to encode url in twig. Show all posts
Showing posts with label how to encode url in twig. Show all posts

Tuesday 12 March 2019

How to encode url in drupal 8?

It's a easy way to encode url in drupal 8 twig template. We just have to follow the simple steps:
Step 1. First create a variable like given example.

Example:
{% set return_url = render_var(url('<front>')) ~ 'contact?msg=success&region=americas' %}

Description: here
   return_url is the variable name and
   url('<front>') is the front page url and
   contact?msg=success&region=americas this section we are concating with " ~ " Tilde sign and
   render_var is the render that full url.

Step 2. Now we have to pass the url in src like given example.

Example: https://www.google.com?Return_URL={{ return_url|url_encode}}

Description: So just call the "return_url" with "url_encode" function in url query string. That will return the encoded url.


Note: If have any suggestions or issue regarding 'How to encode url in drupal 8?' then you can ask by comments. 

How to resolve max execution time error in drupal ?

When you found error regarding 'max_execution_time' exceed, then you can follow steps for resolve this error: Steps:   You can put t...