You are here

public function EntityUrl::resolve in Open Social 10.3.x

Resolver.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to create a canonical URL for.

null|array $options: The options to provide to the URL generator.

Return value

\Drupal\Core\Url Url object.

Throws

\Drupal\Core\Entity\EntityMalformedException

File

modules/custom/social_graphql/src/Plugin/GraphQL/DataProducer/Entity/EntityUrl.php, line 50

Class

EntityUrl
Returns the URL of an entity.

Namespace

Drupal\social_graphql\Plugin\GraphQL\DataProducer\Entity

Code

public function resolve(EntityInterface $entity, ?array $options) {
  return $entity
    ->toUrl('canonical', $options ?? []);
}