disableResourceType example



  /** * Disables any resource types that have been disabled by a test. * * @param \Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent $event * The build event. */
  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();
    }
  }

  /** * Aliases any resource type fields that have been aliased by a test. * * @param \Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent $event * The build event. */
  public function aliasResourceTypeFields(ResourceTypeBuildEvent $event) {
    $aliases = \Drupal::state()->get('jsonapi_test_resource_type_builder.resource_type_field_aliases', []);
    
Home | Imprint | This part of the site doesn't use cookies.