abstract class InputTypePluginBase in GraphQL 8.3
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\graphql\Plugin\GraphQL\InputTypes\InputTypePluginBase implements TypePluginInterface uses CacheablePluginTrait, DescribablePluginTrait, TypedPluginTrait
Expanded class hierarchy of InputTypePluginBase
5 files declare their use of InputTypePluginBase
- CarInput.php in tests/
modules/ graphql_plugin_test/ src/ Plugin/ GraphQL/ InputTypes/ CarInput.php - EntityQueryFilterConditionInput.php in modules/
graphql_core/ src/ Plugin/ GraphQL/ InputTypes/ EntityQuery/ EntityQueryFilterConditionInput.php - EntityQueryFilterInput.php in modules/
graphql_core/ src/ Plugin/ GraphQL/ InputTypes/ EntityQuery/ EntityQueryFilterInput.php - EntityQuerySortInput.php in modules/
graphql_core/ src/ Plugin/ GraphQL/ InputTypes/ EntityQuery/ EntityQuerySortInput.php - MockGraphQLPluginTrait.php in tests/
src/ Traits/ MockGraphQLPluginTrait.php
1 string reference to 'InputTypePluginBase'
File
- src/
Plugin/ GraphQL/ InputTypes/ InputTypePluginBase.php, line 15
Namespace
Drupal\graphql\Plugin\GraphQL\InputTypesView source
abstract class InputTypePluginBase extends PluginBase implements TypePluginInterface {
use CacheablePluginTrait;
use DescribablePluginTrait;
use TypedPluginTrait;
/**
* {@inheritdoc}
*/
public static function createInstance(SchemaBuilderInterface $builder, TypePluginManager $manager, $definition, $id) {
return new InputObjectType([
'name' => $definition['name'],
'description' => $definition['description'],
'contexts' => $definition['contexts'],
'fields' => function () use ($builder, $definition) {
return $builder
->processArguments($definition['fields']);
},
]);
}
/**
* {@inheritdoc}
*/
public function getDefinition() {
$definition = $this
->getPluginDefinition();
return [
'name' => $definition['name'],
'description' => $this
->buildDescription($definition),
'fields' => $this
->buildFields($definition),
'contexts' => $this
->buildCacheContexts($definition),
];
}
/**
* Builds the fields of the type definition.
*
* @param $definition
* The plugin definition array.
*
* @return array
* The list of fields for the input type.
*/
protected function buildFields($definition) {
return array_map(function ($field) use ($definition) {
return [
'type' => $this
->buildFieldType($field, $definition),
'description' => $this
->buildFieldDescription($field, $definition),
'default' => $this
->buildFieldDefault($field, $definition),
];
}, $definition['fields']);
}
/**
* Builds a field's type.
*
* @param array $field
* The field definition array.
*
* @return array
* The parsed type definition array.
*/
protected function buildFieldType($field) {
$type = is_array($field) ? $field['type'] : $field;
return StringHelper::parseType($type);
}
/**
* Builds a field's description.
*
* @param array $field
* The field definition array.
* @param array $definition
* The plugin definition array.
*
* @return string
* The field's description.
*/
protected function buildFieldDescription($field, $definition) {
return (string) (isset($field['description']) ? $field['description'] : '');
}
/**
* Builds a field's default value.
*
* @param array $field
* The field definition array.
* @param array $definition
* The plugin definition array.
*
* @return mixed
* The field's default value.
*/
protected function buildFieldDefault($field, $definition) {
return isset($field['default']) ? $field['default'] : NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheablePluginTrait:: |
protected | function | ||
DescribablePluginTrait:: |
protected | function | ||
InputTypePluginBase:: |
protected | function | Builds a field's default value. | |
InputTypePluginBase:: |
protected | function | Builds a field's description. | |
InputTypePluginBase:: |
protected | function | Builds the fields of the type definition. | |
InputTypePluginBase:: |
protected | function | Builds a field's type. | |
InputTypePluginBase:: |
public static | function |
Overrides TypePluginInterface:: |
|
InputTypePluginBase:: |
public | function |
Returns the plugin's type or field definition for the schema. Overrides TypePluginInterface:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 92 |
TypedPluginTrait:: |
protected | function |