function ResourceTypeBuildEventSubscriber::disableResourceType
Same name in other branches
- 9 core/modules/jsonapi/tests/modules/jsonapi_test_resource_type_building/src/EventSubscriber/ResourceTypeBuildEventSubscriber.php \Drupal\jsonapi_test_resource_type_building\EventSubscriber\ResourceTypeBuildEventSubscriber::disableResourceType()
- 8.9.x core/modules/jsonapi/tests/modules/jsonapi_test_resource_type_building/src/EventSubscriber/ResourceTypeBuildEventSubscriber.php \Drupal\jsonapi_test_resource_type_building\EventSubscriber\ResourceTypeBuildEventSubscriber::disableResourceType()
- 11.x core/modules/jsonapi/tests/modules/jsonapi_test_resource_type_building/src/EventSubscriber/ResourceTypeBuildEventSubscriber.php \Drupal\jsonapi_test_resource_type_building\EventSubscriber\ResourceTypeBuildEventSubscriber::disableResourceType()
Disables any resource types that have been disabled by a test.
Parameters
\Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent $event: The build event.
File
-
core/
modules/ jsonapi/ tests/ modules/ jsonapi_test_resource_type_building/ src/ EventSubscriber/ ResourceTypeBuildEventSubscriber.php, line 36
Class
- ResourceTypeBuildEventSubscriber
- Event subscriber which tests disabling resource types.
Namespace
Drupal\jsonapi_test_resource_type_building\EventSubscriberCode
public function disableResourceType(ResourceTypeBuildEvent $event) {
$disabled_resource_types = \Drupal::state()->get('jsonapi_test_resource_type_builder.disabled_resource_types', []);
if (in_array($event->getResourceTypeName(), $disabled_resource_types, TRUE)) {
$event->disableResourceType();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.