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

Add "Table class" option to views table formatter UI

$
0
0

Problem/Motivation

The Drupal 7 contrib version of the Views module provided an option for the table style to add CSS classes to the table element itself via the UI. This feature was not implemented when Views was moved to core in Drupal 8. This feature is desirable for site builders and themers because it allows style variations such as table row striping, borderless rows, etc. to be easily added via the UI to specific tables outputted by Views.

Added this functionality will also bring feature parity with the Drupal 7 version in this regard.

Steps to reproduce

  1. Create a view with a table style.
  2. Open the table style options modal in the Views UI
  3. See that there is not a form field to add custom CSS classes to table element.

Proposed resolution

Provide a configuration form option in the Views table style plugin to set custom CSS classes to the table element itself.

Remaining tasks

  1. Convert existing patch to MR.
  2. Confirm functionality works with latest core version.
  3. Change CSS option to table style configuration schema.
  4. Add test to confirm functionality.

User interface changes

A new text input added to the table style options.

See #26 for screenshots

API changes

None

Data model changes

  1. Add CSS class option to table style plugin configuration schema.

Original report by Anybody

Drupal 8 Follow-up of the Drupal 7 issue #1689472: add class to table in table format, which was committed on 2019-04-04.

Like before in Drupal 7 the Drupal 8 views table formatter only allows to set a class on rows in the UI but not on the table itself, while that would be consistent to other formatters and helpful in several cases.

How can one add a class to the rendered table when a view is outputted as table?

In html-list format for example one can add a class to a wrapper OR/AND to the list. Is this possible to the table as well?

Thanks!


Viewing all articles
Browse latest Browse all 292228

Trending Articles



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