overriding views-view-unformatted.html.twig - theming views-view-unformatted.html.twig in Drupal 8, 9

If u want to add custom html in views and custom html for field follow the below step.

1.  copy views-view-unformatted.html.twig from core/views/templates and paste in your custom theme folder .


overriding views-view-unformatted.html.twig - theming views-view-unformatted.html.twig in Drupal 8, 9



overriding views-view-unformatted.html.twig - theming views-view-unformatted.html.twig in Drupal 8, 9












2. if you want to theme for a particular  view/ page naming convention below

views-view-unformatted--[view name]--[page/block id].html

suppose I have View name is [exhibition_resources] and page id [page_1] custom view twig tpl name is

views-view-unformatted--exhibition-resources--page-1.html.twig

overriding views-view-unformatted.html.twig - theming views-view-unformatted.html.twig in Drupal 8, 9













for print field value follow below code

{{row.content['#row']._entity.field machine name.value}}

for getting image and pdf url kindly use below code

{{file_url(row.content['#row']._entity.field_pdf.entity.fileuri)}}









No comments:

Write a program in PHP to reverse a number

A number can be written in reverse order. For example 12345 = 54321 <?php   $ num = 23456;   $ revnum = 0;   while ($ num > 1)   {   $...