Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LabelOnlyResourceObject.php

function LabelOnlyResourceObject::createFromEntity

Overrides ResourceObject::createFromEntity

1 call to LabelOnlyResourceObject::createFromEntity()
EntityAccessChecker::getAccessCheckedResourceObject in core/modules/jsonapi/src/Access/EntityAccessChecker.php
Get the object to normalize and the access based on the provided entity.

File

core/modules/jsonapi/src/JsonApiResource/LabelOnlyResourceObject.php, line 30

Class

LabelOnlyResourceObject
Value object decorating a ResourceObject; only its label is available.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public static function createFromEntity(ResourceType $resource_type, EntityInterface $entity, ?LinkCollection $links = NULL) {
    $resource_object = new static($entity, $resource_type, $entity->uuid(), $resource_type->isVersionable() && $entity instanceof RevisionableInterface ? $entity->getRevisionId() : NULL, static::extractFieldsFromEntity($resource_type, $entity), static::buildLinksFromEntity($resource_type, $entity, $links ?: new LinkCollection([])));
    $resource_object->setEntity($entity);
    return $resource_object;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal