Last active
April 28, 2019 12:11
-
-
Save blazeyo/b3c4e53563ab477898b63dc408d99f65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\my_module\Plugin\GraphQL\Fields\Entity; | |
use Drupal\Core\Entity\EntityInterface; | |
use Drupal\graphql\GraphQL\Execution\ResolveContext; | |
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase; | |
use GraphQL\Type\Definition\ResolveInfo; | |
/** | |
* @GraphQLField( | |
* id = "label", | |
* secure = true, | |
* name = "label", | |
* type = "String", | |
* parents = {"NodeArticle"} | |
* ) | |
*/ | |
class NodeStoryParagraphImage extends FieldPluginBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) { | |
if ($value instanceof EntityInterface) { | |
return $value->label(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment