class TypedDataPrimitiveFallback in GraphQL 8.3
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\graphql_core\Plugin\Deriver\Scalars\TypedDataPrimitiveFallback implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of TypedDataPrimitiveFallback
File
- modules/
graphql_core/ src/ Plugin/ Deriver/ Scalars/ TypedDataPrimitiveFallback.php, line 12
Namespace
Drupal\graphql_core\Plugin\Deriver\ScalarsView source
class TypedDataPrimitiveFallback extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The typed data manager.
*
* @var \Drupal\Core\TypedData\TypedDataManagerInterface
*/
protected $typedDataManager;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $basePluginId) {
return new static($container
->get('typed_data_manager'));
}
/**
* TypedDataPrimitiveFallback constructor.
*
* @param \Drupal\Core\TypedData\TypedDataManagerInterface $typedDataManager
* The typed data manager.
*/
public function __construct(TypedDataManagerInterface $typedDataManager) {
$this->typedDataManager = $typedDataManager;
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($basePluginDefinition) {
// Add a derivative for the actual "any" type.
$this->derivatives['any'] = $basePluginDefinition;
foreach ($this->typedDataManager
->getDefinitions() as $typeName => $typeDefinition) {
if (in_array('Drupal\\Core\\TypedData\\PrimitiveInterface', class_implements($typeDefinition['class']))) {
$this->derivatives[$typeName] = [
'name' => StringHelper::camelCase($typeName),
'description' => !empty($typeDefinition['description']) ? $typeDefinition['description'] : '',
'provider' => isset($typeDefinition['provider']) ? $typeDefinition['provider'] : null,
'weight' => -10,
'type' => $typeName,
] + $basePluginDefinition;
}
}
return parent::getDerivativeDefinitions($basePluginDefinition);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
TypedDataPrimitiveFallback:: |
protected | property | The typed data manager. | |
TypedDataPrimitiveFallback:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
TypedDataPrimitiveFallback:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
TypedDataPrimitiveFallback:: |
public | function | TypedDataPrimitiveFallback constructor. |