Configuration Views
config_views
Enables site builders to create Views based on configuration entities, such as roles, menus, image styles, and content types.
Overview
Configuration Views extends Drupal's Views module to support configuration entities as a data source. This allows site builders to create customized lists of configuration items like content types, menus, image styles, taxonomy vocabularies, user roles, and virtually any other configuration entity in Drupal.
The module provides a custom query plugin that leverages Drupal's Entity Query API to fetch configuration entities, along with specialized filter handlers for string and boolean fields. It also includes a field handler for displaying entity operations (edit, delete, etc.) and an Entity Reference Selection plugin that allows Views to be used as the source for entity reference fields targeting configuration entities.
Upon installation, the module provides 14 pre-configured Views that replace standard Drupal admin listing pages. These Views can be customized, extended with exposed filters, sorted, paginated, and exported to various formats - bringing the full power of Views to configuration management interfaces.
Install
composer require 'drupal/config_views:^2.1'
Features
- Custom Views query plugin (views_config_entity_query) that enables querying configuration entities using Drupal's Entity Query API
- String filter plugin (config_entity_string) with operators: equals, not equals, contains, starts with, ends with, is empty, is not empty
- Boolean filter plugin (config_entity_boolean) for filtering configuration entity boolean fields
- Operations field plugin (config_entity_operations) that renders entity operation links (edit, delete, etc.)
- Entity Reference Selection plugin (config_views) allowing Views to filter configuration entity references
- 14 pre-built Views replacing core admin pages for: comment types, contact forms, content types, custom block types, date formats, form modes, image styles, menus, shortcuts, taxonomy vocabularies, text formats, user roles, view modes, and views list
- Automatic Views wizard categorization that groups configuration entity Views under 'Configuration' in the Add View form
- Support for full Views functionality including exposed filters, sorting, paging, and various display formats
- Hook implementation to organize view wizards by grouping content and configuration options alphabetically
Use Cases
Creating a filtered list of content types
Site builders can customize the Content types view to add exposed filters, allowing administrators to search for specific content types by name or filter by properties like whether they have a description. The view can be sorted by any available field.
Building a role-based entity reference field
Using the config_views Entity Reference Selection handler, developers can create an entity reference field that references user roles, filtered by a View. For example, a field could reference only roles that have a specific permission or match certain criteria defined in the View's filters.
Customizing admin pages with Views features
Replace standard Drupal admin listing pages with Views-powered versions that support pagination, exposed search filters, sortable columns, and the ability to export lists (with appropriate export modules like Views Data Export).
Creating a dashboard of all enabled Views
Enable the views_list View to get a customizable list of all Views on the site. The View shows enabled and disabled views separately and can be customized to add filters by tag, show only views with specific displays, etc.
Managing image styles with search
Customize the image_styles View to add an exposed filter on the style name, making it easier to find specific image styles on sites with many style definitions.
Tips
- Some Views are disabled by default. Review them at /admin/structure/views and enable the ones you want to use.
- The module automatically makes all configuration entity types available as Views base tables - not just the 14 pre-built Views.
- When creating a new View, look under the 'Configuration' group in the 'Show' dropdown to find all available configuration entity types.
- The config_views Entity Reference Selection handler is useful when you need to reference configuration entities (like roles) from entity reference fields and want Views filtering capabilities.
- All standard Views features work with configuration entity Views: exposed filters, sorts, pagers, different display types, relationships, and more.
Dependencies
Related Projects
Extends Views with configuration entity query support, filter handlers, field handlers, and entity reference selection. All Views functionality (displays, pagers, exposed filters, etc.) is available for configuration entity views.
Provides an Entity Reference Selection plugin that allows Views to filter and populate entity reference fields targeting configuration entities.
The module enhances the Views UI Add View form by organizing the base table options into 'Configuration' and 'Content' groups for better usability.
Admin Pages
| Title | Path | Description |
|---|---|---|
| Comment types | /admin/structure/comment |
Lists all comment types defined on the site. Displays comment type label, description, and provides operation links for editing and managing each comment type. Replaces the core comment types admin page. |
| Contact forms | /admin/structure/contact |
Lists all contact forms. Displays form label, recipients (reply field), and operation links. This View is disabled by default. |
| Content types | /admin/structure/types |
Lists all content types with their names, descriptions, and operation links. Provides a Views-based replacement for the core content types admin page with full pagination support. |
| Custom block library | /admin/structure/block/block-content/types |
Lists all custom block types with labels linked to their edit pages, descriptions, and operation links. |
| Date and time formats | /admin/config/regional/date-time |
Lists all date format configurations showing the format name, pattern, and operation links. |
| Form modes | /admin/structure/display-modes/form |
Lists all entity form modes grouped by target entity type. Shows the form mode name and operations. This View is disabled by default. |
| Image styles | /admin/config/media/image-styles |
Lists all image styles showing the style name and operation links for editing, flushing, and deleting styles. |
| Menus | /admin/structure/menu |
Lists all menus with their names (displayed in bold), descriptions, and operation links. Sorted alphabetically by label. |
| Shortcuts | /admin/config/user-interface/shortcut |
Lists all shortcut sets with their names and operation links. |
| Taxonomy | /admin/structure/taxonomy |
Lists all taxonomy vocabularies sorted alphabetically by name, with operation links for managing terms and vocabulary settings. |
| Text formats and editors | /admin/config/content/formats |
Lists all text formats/filter formats with their names and operation links. This View is disabled by default. |
| User Roles | /admin/people/roles |
Lists all user roles sorted by weight, showing role labels and operation links. This View is disabled by default. |
| View modes | /admin/structure/display-modes/view |
Lists all entity view modes grouped by target entity type. Shows the view mode name and operations. This View is disabled by default. |
| Views | /admin/structure/views |
Lists all Views separated into Enabled and Disabled sections. Shows view name (as h3 heading), description, tag, and operations. The disabled views appear in a footer block. This View is disabled by default. |
Hooks
| Hook | Description |
|---|---|
hook_views_data |
Implements hook_views_data() to register all configuration entity types as Views base tables. Dynamically discovers all configuration entities and creates Views data definitions including fields, filters, sorts, and arguments based on the entity's config schema. |
hook_form_FORM_ID_alter |
Implements hook_form_view_add_form_alter() to reorganize the Views wizard selection dropdown, grouping configuration entity types under a 'Configuration' optgroup and content types under 'Content', with alphabetical sorting within each group. |
Troubleshooting
Several Views are disabled by default because they may not perfectly replicate core's admin page design. Enable them at /admin/structure/views only after reviewing that they meet your needs. You can then customize them to match your requirements.
The module currently provides limited fields (name, description, id, etc.). Getting entity-specific fields for all configuration entity types is a work in progress. Use available fields from the config schema or create custom field handlers.
Views for managing fields (field_config entities) are not yet implemented. This is a known limitation.
Configuration entity queries use a different pagination mechanism than SQL queries. Ensure you're using a compatible pager type (full pager or mini pager work correctly).
Security Notes
- Each pre-configured View respects core permission requirements (e.g., 'administer content types', 'administer permissions'). Access control is configured on each View.
- When customizing Views or creating new ones based on configuration entities, ensure appropriate access restrictions are configured to prevent unauthorized access to configuration data.