Skip to content
Snippets Groups Projects

Draft: Resolve #3462514 "Support for link"

Files
5
<?php
declare(strict_types=1);
namespace Drupal\graphql_compose_linkattributes\Plugin\GraphQLCompose\SchemaType;
use Drupal\graphql_compose\Plugin\GraphQLCompose\GraphQLComposeSchemaTypeBase;
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type;
/**
* {@inheritdoc}
*
* @GraphQLComposeSchemaType(
* id = "LinkAttributes",
* )
*/
class LinkAttributes extends GraphQLComposeSchemaTypeBase {
/**
* {@inheritdoc}
*/
public function getTypes(): array {
$types = [];
$types[] = new ObjectType([
'name' => $this->getPluginId(),
'description' => (string) $this->t('Link item attributes set within the CMS.'),
'fields' => function () {
$fields['id'] = [
'type' => Type::string(),
'description' => 'The ID of the link.',
];
$fields['name'] = [
'type' => Type::string(),
'description' => 'The name of the link.',
];
$fields['title'] = [
'type' => Type::string(),
'description' => 'The title of the link.',
];
$fields['target'] = [
'type' => Type::string(),
'description' => 'The target of the link.',
];
$fields['rel'] = [
'type' => Type::string(),
'description' => 'The rel of the link.',
];
$fields['class'] = [
'type' => Type::listOf(Type::string()),
'description' => 'The classes of the link.',
];
$fields['accessKey'] = [
'type' => Type::string(),
'description' => 'The accesskey of the link.',
];
$fields['ariaLabel'] = [
'type' => Type::string(),
'description' => 'The aria_label of the link.',
];
return $fields;
},
]);
return $types;
}
}
Loading