You are here

DefaultInternalUrl.php in GraphQL 8.3

File

modules/graphql_core/src/Plugin/GraphQL/Types/Routing/DefaultInternalUrl.php
View source
<?php

namespace Drupal\graphql_core\Plugin\GraphQL\Types\Routing;

use Drupal\Core\Url;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql\Plugin\GraphQL\Types\TypePluginBase;
use GraphQL\Type\Definition\ResolveInfo;

/**
 * @GraphQLType(
 *   id = "default_internal_url",
 *   name = "DefaultInternalUrl",
 *   interfaces = {"InternalUrl"},
 *   weight = -1
 * )
 */
class DefaultInternalUrl extends TypePluginBase {

  /**
   * {@inheritdoc}
   */
  public function applies($object, ResolveContext $context, ResolveInfo $info) {
    return $object instanceof Url && !$object
      ->isExternal();
  }

}

Classes

Namesort descending Description
DefaultInternalUrl Plugin annotation @GraphQLType( id = "default_internal_url", name = "DefaultInternalUrl", interfaces = {"InternalUrl"}, weight = -1 )