Consolidate administrative tables into singular theme callback/component

Created on 7 February 2013, over 12 years ago
Updated 22 July 2025, 11 days ago

In doing the Twig conversion, we are moving many concatenation-based theme functions into templates. Some of these are for administrative forms, which are based on tables.

Most of these follow a similar design pattern:


HEADING
-------

[ Global operation button(s) ]

[ Filter form ]

[ Operations form ]

[ Show/hide details link ]

+===========================================+
| HEADING        | HEADING     | OPERATIONS |
+================+=============+============+
| Foo            | Oof         | edit del   +
+ ---------------|-------------|------------+
| Bar            | Rab         | edit del   +
+ ---------------|-------------|------------+
| Baz            | Zab         | edit del   +
+===========================================+

[ Global operation button(s) ]

This pattern is similar to what we sometimes accomplish with http://drupal.org/project/views_bulk_operations

Below are some URLs in core where these exist (this is not an exhaustive list).

/admin/content
/admin/content/comment
/admin/structure/types
/admin/people
/admin/people/roles
/admin/config/content/formats
/admin/config/media/image-styles
/admin/config/regional/date-time
/admin/modules (similar)

Many of these provide a theme function to style the form they use. It seems better that we should provide instead a consolidated "administrative interface" theme component so that we can reduce the duplication in the theme system

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

theme system

Created by

πŸ‡ΊπŸ‡ΈUnited States c4rl

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    I have been pondering about tables in Drupal for quite a while.

    We have all kinds of tables. HTML tables in the editor, or in templates. Views tables, and admin UI.

    There is a table theme hook, which can make the header sticky. But views does not use this.

    There are draggable tables for multivalue fields, and responsive tables that make columns disappear.

    There are different styles and layouts for tables, like scrolling horizontally when they don't fit, or a small/compact version vs full width.

    Lots of fixes are implemented in themes like Gin, and need to be rebuilt for your own. Try using your custom theme as the admin theme and you will encounter UI challenges that can be tedious to fix.

    Views has a pretty powerful table display, but it's still limited. Modules like Views Aggregator Plus and Views Table Rowspan add additional features, but they can't be combined.

    This issue started as a suggestion to use the table hook or something similar. Then it was asked if views could render the table. What seems to be missing is some kind of unified table API.

    I recently looked into front end table components like DataTables (https://datatables.net/). But that made me question whether this (still jquery) library is any better than what we can already do with the views table (sort/filter/search via ajax).

    There is the TanStack table (https://tanstack.com/table/latest), which is a different paradigm since it's sort of a full stack component, but unlike views, is not a query builder.

    The thing I like about these libraries are that they are quite robust and fully documented. Making complex tables in Drupal can be pretty rough if you don't know about things like views development or advanced theming.

    I can't quite visualize the solution I'm looking for. But I think these two libraries represent the major paradigm shift for drupal and web development. We used to render a table in the back end and sprinkle it with jquery on the front end. Now we want a unified component on the front/back end so we can reasonably work on more complex components without things becoming tangled or inconsistent.

    A further question is whether tables are the right choice for these admin screens. Are they really tabular data, or are we just trying to display info in a grid? Responsive tables that collapse (IE tablesaw library) are generally preferred on mobile devices vs horizontal scrolling, especially for an interactive UI like a content type's fields config. I like the ability to copy and paste field settings into a spreadsheet, but having a usable UI on my device is more important.

Production build 0.71.5 2024