Drupal theme Views template modifications

97 views Asked by At

I have implemented a simple View to output some data sourced from an api.

The issue is the Views table is included within a div with a class of table-responsive as shown below:

enter image description here

I attempted to locate the div.table-responsive markup by extending the display output template of my view but the markup in there does not account for that div.

Testing the following code:

<div class="view-content testing-content">
      <?php print $rows; ?>
</div>
<div>TESTING</div>

I found the print $rows statement is what's printing the not only the rows but the div.table-responsive within which they are contained.

Can anyone advice how I can override the theme, from a module, so that in specific cases I can remove the table-responsive class of that div?

1

There are 1 answers

0
Scott Anderson On

You should be able to override the top level Views template file for the specific View(s) you want to remove the class from.

In your View edit page go to Advanced -> Other -> Theme: Information Try the first template listed and note the suggested template files names for the specific View.

Display output: views-view.tpl.php

If doing this doesn't resolve the problem... are you using a Bootstrap theme? If so you may need to check the template.php file for a function that adds the "table-responsive" class as a wrapper around tables.