getResourceTypeName 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) {
    

  protected function createResourceType(EntityTypeInterface $entity_type$bundle) {
    $type_name = NULL;
    $raw_fields = $this->getAllFieldNames($entity_type$bundle);
    $internalize_resource_type = $entity_type->isInternal();
    $fields = static::getFields($raw_fields$entity_type$bundle);
    if (!$internalize_resource_type) {
      $event = ResourceTypeBuildEvent::createFromEntityTypeAndBundle($entity_type$bundle$fields);
      $this->eventDispatcher->dispatch($event, ResourceTypeBuildEvents::BUILD);
      $internalize_resource_type = $event->resourceTypeShouldBeDisabled();
      $fields = $event->getFields();
      $type_name = $event->getResourceTypeName();
    }
    return new ResourceType(
      $entity_type->id(),
      $bundle,
      $entity_type->getClass(),
      $internalize_resource_type,
      static::isLocatableResourceType($entity_type$bundle),
      static::isMutableResourceType($entity_type$bundle),
      static::isVersionableResourceType($entity_type),
      $fields,
      $type_name
    );
Home | Imprint | This part of the site doesn't use cookies.