Skip to main content
The problem You have a piece of HTML code that needs to be included in multiple Twig templates. The code will be consistent across all of them - if you need to change it, you need to change it everywhere it is used. As an example, I recently had to include a piece of code in multiple twig files. I want to include this code in some, but not all, of the node templates. A solution
Fraction Slider is a jQuery plugin which adds a fully customization element slider to your website. Fraction Slider is HTML5 multi-layer and parallax slideshow. Works fine with views fields. Features Multi-Layer slider Parallax Support Similar to Layerslide Installation
While using Drupal Address Field module, When it needs to customize field, its variable returns country as ISO code. Like, if "Pakistan" will return "PK". This funtion will help to convert ISO country code to country name.   <?php $country_iso = $node->field_address['und'][0]['country']; // Example, return "TR" $country = _addressfield_country_options_list($country_iso); print $country; // will print Turkey ?>  
It's really a potential security risk for people new to Drupal or PHP for using PHP Filter code. Some of these listed. Code in your database can not be version controlled and is also harder to find in general later on. Eval()'d code is much slower than something hardcoded in a file. If there is an error somewhere in that code, you will get a very unhelpful error message (error in eval()'d code at line 3) and you might even have go through your database manually to find and fix the error.