Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295290

Views module is adding an extra div.views-element-container for no reason

$
0
0

Problem/Motivation

Views module is adding an extra <div> element for no apparent reason when rendering a view block (and elsewhere maybe? haven't verified this). As if having the wrapper from both the block and views-view templates wasn't enough, there is a third coming through via the Views element pre-render callback, which sets #theme_wrappers container.

<?php
  if (empty($view->display_handler->getPluginDefinition()['returns_response'])) {
    $element['#attributes']['class'][] = 'views-element-container';
    $element['#theme_wrappers'] = array('container');
  }
<div class="block block-blah-blah"><div class="views-element-container"><div class="view view-name blah-blah">
      ...</div></div></div>

Proposed resolution

Remove it:

<div class="block block-blah-blah"><div class="view view-name blah-blah">
    ...</div></div>

Remaining tasks

TBD

User interface changes

None.

API changes

None.

Data model changes

None.


Viewing all articles
Browse latest Browse all 295290

Trending Articles