Issue #3575185: Add JSON:API Views settings page
Summary
Issue #3575185: Add a JSON:API Views settings page for bulk management of resource exposure.
This adds an admin settings form that lists enabled View displays and allows administrators to enable or disable JSON:API Views resources in bulk using checkboxes. Changes are saved through Drupal’s Batch API.
Details
The new settings page is available at:
/admin/config/services/jsonapi/views
The form lists each eligible enabled View display with:
- View label
- View ID
- Display title
- Display ID
- Display type
- JSON:API resource path
- Exposure status checkbox
On submit, only changed display settings are saved. The batch operation groups updates by View entity and writes the existing display_extenders.jsonapi_views.enabled setting for each display.
The form treats missing jsonapi_views extender settings as enabled, matching the module’s current default behaviour.
Access
Adds a new restricted permission:
administer jsonapi views
This controls access to the bulk settings page.
Uses administer views permission.
Test Coverage
Adds functional test coverage for:
- Access control on the settings page
- Rendering the available View displays
- Correct default checkbox state for enabled and disabled displays
- Bulk disabling an exposed display
- Bulk enabling a previously disabled display
- Confirming saved View configuration after batch processing
Also removes two obsolete keys from the test View fixture that current Drupal core rejects during strict config schema checking.
Testing Performed
php -l src/Form/SettingsForm.phpphp -l tests/src/Functional/JsonapiViewsSettingsFormTest.phpvendor/bin/phpcs --standard=Drupal,DrupalPractice ...vendor/bin/yaml-lint ...ddev exec vendor/bin/phpunit -c phpunit.xml.dist web/modules/contrib/jsonapi_views/tests/src/Functional/JsonapiViewsSettingsFormTest.php
Result: new functional test passes with 2 tests and 22 assertions.
Closes #3575185