I am trying to customize a responsive grid view in D8 using Bootstrap Grid. Code is working, but I am trying to find out if some extra divs can be removed.  

Currently I am getting

  • two divs from <!-- THEME HOOK: 'region' -->, which work ar 'content' and 'content-inner' so they are okay (I see their purpose). 
  • region.html.twig calls {{ content }} which initiate <!-- THEME HOOK: 'block' --> and makes a div ===> Use ??
  • <!-- THEME HOOK: 'container' --> is called which makes a div ===> Use ??, then
  • <!-- THEME HOOK: 'views_view' --> creates two divs which finally calls 
  • <!-- THEME HOOK: 'views_bootstrap_grid' --> which makes a div of 'grid' class and then rows divs are created. 

To improve my HTML text ratio I want to remove some of these divs. Do I need to write some hooks, and how do I still call the next twig files which show content?   

Comments

nick_helps’s picture

Hi,

Can anyone point me into the right direction. Any link explaining this would do. 

Thanks!

wombatbuddy’s picture

Could you rephrase your question?

nick_helps’s picture

Drupal views create a lot of <Div>s. 

To improve my site's HTML-Text ratio I want to remove some of those div tags if possible. 

Does anyone know how to do that? Please see the list of divs given in the main question

wombatbuddy’s picture

You can alter variables (that you have in Twig templates) using 'function hook_preprocess_HOOK'.
See this tutorial: 'hook_preprocess and hook_preprocess_hook functions in Drupal 8'.

nick_helps’s picture

Great, 

Thanks