Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I noticed two problems in the html output of the "Display suite fields" row plugin for views
(class views_plugin_ds_fields_view)
1. Missing class "clear-block" on views rows.
We need this class to clear the floating ds regions.
Temporary fix: Custom module with
<?php
function mymodule_preprocess_views_view_unformatted(&$vars) {
if (is_a($vars['view']->style_plugin->row_plugin, 'views_plugin_ds_fields_view')) {
foreach ($vars['classes'] as $id => $class) {
$vars['classes'][$id] .= ' clear-block';
}
}
}
?>
2. No class on fields
It's hard to target individual fields with css, if they don't have a class with them.
Temporary fix:
In views_plugin_ds_fields_view::ds_fields_render()
<?php
// Class.
$class = '';
if (!empty($this->view->style_plugin->row_plugin->options[$key]['css-class'])) {
$class = $this->view->style_plugin->row_plugin->options[$key]['css-class'];
}
?>
becomes
<?php
// Class.
$class = 'views-field-' . $field->class . ' ';
if (!empty($this->view->style_plugin->row_plugin->options[$key]['css-class'])) {
$class = $this->view->style_plugin->row_plugin->options[$key]['css-class'];
}
?>
------
Fyi, I did this on display suite 6.x-1.4
Comments
Comment #1
swentel CreditAttribution: swentel commented1. Should we just include this always in ds by default or not then ?
2. this is related to #1003380: Original field css class has disappeared. also - wondering how to make sure I don't break this again.
Comment #2
aspilicious CreditAttribution: aspilicious commentedThere is no use in changing this now. Closing this to make the queue maintainable.