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

Views templates don't handle attributes

$
0
0

Found this in Drupal 7 but it looks similar in 8.x as well.

In views preprocess hooks, there's an empty $attributes_array variable. Adding anything to this doesn't do anything because it's not printed in the template.

<?php

/**
* @file
* Default simple view template to display a list of rows.
*
* @ingroup views_templates
*/
?>

<?php if (!empty($title)): ?>
  <h3><?php print $title; ?></h3>
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
  <div <?php print $row_classes[$id]; ?>>
    <?php print $row; ?>
  </div>
<?php endforeach; ?>

The only way to get custom attributes is to override the template and do your own handling in preprocess.


Viewing all articles
Browse latest Browse all 291521

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>