We use '.tpl.php' extension for druapl 7 but now in case of drupal 8 extension is '.html.twig'.
Lets talk about twig file..
{% if ... %}
/* write comment here */
{% else %}
/* write comment here */
{% endif %}
{% set variable name = "variable value" %} then write {{ variable name }} and use it easily.
Lets talk about twig file..
- For node id in twig file syntax.. {{ node.id }}
- For node title in twig file syntax.. {{ node.label }}
- For node body in twig file syntax.. {{ node.body }}
- For node any field.. {{ content.field_machine_name[0] }} or {{ content.field_machine_name.0 }}
if else syntax..
/* write comment here */
{% else %}
/* write comment here */
{% endif %}
For create variable in twig file syntax..
No comments:
Post a Comment