Showing posts with label taxonomy template. Show all posts
Showing posts with label taxonomy template. Show all posts

Tuesday 7 August 2018

How to render fields on Taxonomy twig templates?

It is easy to call/render taxonomy fields on taxonomy template. We just have to create template file according to vocabulary machine name like 'application landing page' is taxonomy and machine name will be 'application_landing_page', but our template name will be 'taxonomy-term--application-landing-page.html.twig' as per Drupal 8(Symphony) Syntax.

and we will call/render fields like..


Term id: {{ term.id }}  // term id

Term Url: {{ url }}  // current page url

Term Title: {{ term.label }}  // term title

Term Image: {{ file_url(term.field_product_group_image.entity.uri.value) }}  // show url of product group image is the image field in taxonomy

Term Description/body: {{ content.description }}

Term Link field: {{ term.field_link.0.url }}

Term Link Title field: {{ term.field_link.0.title }}

Term custom field: {{ content.field_machine_name }}


If we want to check any field value exist or not then we are giving an example like we have field 'line of business' so machine name will be line_of_busines and we will check by..

{% if content.field_line_of_busines is not empty %}

{{ content.field_line_of_busines }}

{% endif %}



Note: If have any suggestions or issue regarding 'How to render fields on Taxonomy twig templates' then you can ask by comments.

Friday 3 August 2018

Naming convention for taxonomy template in drupal 8.

The naming convention of taxonomy is very simple and we will explain by..

Example 1. If we have taxonomy with name of 'product groups' so our this taxonomy machine name will be 'product_groups' but we will take as a 'taxonomy-term--product-groups.html.twig' in naming convention.

Example 2. If we have taxonomy with name of 'service support' so our this taxonomy machine name will be 'service_support' but we will take as a 'taxonomy-term--services-support.html.twig' in naming convention.


Note: If have any suggestions or issue regarding 'Naming convention for taxonomy template' 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...