buildLinksFromEntity example


  public static function createFromEntity(ResourceType $resource_type, EntityInterface $entity, LinkCollection $links = NULL) {
    return 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([])),
      $entity->language()
    );
  }

  /** * Whether the resource object has the given field. * * @param string $public_field_name * A public field name. * * @return bool * TRUE if the resource object has the given field, FALSE otherwise. */
/** * {@inheritdoc} */
  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;
  }

  /** * Gets the decorated entity. * * @return \Drupal\Core\Entity\EntityInterface * The label for which to only normalize its label. */
  
Home | Imprint | This part of the site doesn't use cookies.