Add Support for Available on Current Domain to any Entity Type

Created on 22 September 2024, 4 months ago

Drupal Version

10.3.2

Domain module version

2.0.x-dev

Expected Behavior

A user installs a module with an entity and needs to add the Available on Current Domain filter to a view for an entity type that is installed with that module. If I add field_domain_access and field_domain_all_affiliates, I want to use the Available on Current Domain filter.

Actual Behavior

Available on Current Domain filter is hard-coded to be only available for `node` entities.

Steps to reproduce

1. Enable a module: group, media, etc
2. Create a view for group or media
3. Try to add Available on Current Domain filter
4. Not available in filter list

Steps to resolve

1. In domain_access.module, in hook method domain_access_views_data_alter(), iterate entity types via entity type manager interface and add the Available on Current Domain for all available entity types.
2. In DomainAccessCurrentAllFilter.php, alter the query() method to check if the `table` is `field_domain_access`, and `explode` on `__` to get the base entity type and replace the hard-coded `node` value.

Feature request
Status

Active

Version

2.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024