class LanguageId in GraphQL 8.3
Same name in this branch
- 8.3 modules/graphql_core/src/Plugin/GraphQL/Enums/Languages/LanguageId.php \Drupal\graphql_core\Plugin\GraphQL\Enums\Languages\LanguageId
- 8.3 modules/graphql_core/src/Plugin/GraphQL/Fields/Languages/LanguageId.php \Drupal\graphql_core\Plugin\GraphQL\Fields\Languages\LanguageId
Generates an enumeration of numbers.
Plugin annotation
@GraphQLEnum(
id = "language_id",
name = "LanguageId"
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\graphql\Plugin\GraphQL\Enums\EnumPluginBase implements TypePluginInterface uses CacheablePluginTrait, DescribablePluginTrait
- class \Drupal\graphql_core\Plugin\GraphQL\Enums\Languages\LanguageId implements ContainerFactoryPluginInterface
- class \Drupal\graphql\Plugin\GraphQL\Enums\EnumPluginBase implements TypePluginInterface uses CacheablePluginTrait, DescribablePluginTrait
Expanded class hierarchy of LanguageId
2 string references to 'LanguageId'
- EntityByIdDeriver::getDerivativeDefinitions in modules/
graphql_core/ src/ Plugin/ Deriver/ Fields/ EntityByIdDeriver.php - Gets the definition of all derivatives of a base plugin.
- EntityRevisionByIdDeriver::getDerivativeDefinitions in modules/
graphql_core/ src/ Plugin/ Deriver/ Fields/ EntityRevisionByIdDeriver.php - Gets the definition of all derivatives of a base plugin.
File
- modules/
graphql_core/ src/ Plugin/ GraphQL/ Enums/ Languages/ LanguageId.php, line 18
Namespace
Drupal\graphql_core\Plugin\GraphQL\Enums\LanguagesView source
class LanguageId extends EnumPluginBase implements ContainerFactoryPluginInterface {
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $pluginId, $pluginDefinition) {
return new static($configuration, $pluginId, $pluginDefinition, $container
->get('language_manager'));
}
/**
* LanguageId constructor.
*
* @param array $configuration
* The plugin configuration array.
* @param string $pluginId
* The plugin id.
* @param array $pluginDefinition
* The plugin definition array.
* @param \Drupal\Core\Language\LanguageManagerInterface $languageManager
* The language manager service.
*/
public function __construct(array $configuration, $pluginId, $pluginDefinition, LanguageManagerInterface $languageManager) {
parent::__construct($configuration, $pluginId, $pluginDefinition);
$this->languageManager = $languageManager;
}
/**
* {@inheritdoc}
*/
public function buildEnumValues($definition) {
$values = parent::buildEnumValues($definition);
foreach ($this->languageManager
->getLanguages() as $language) {
$name = str_replace('-', '_', $language
->getId());
$values[strtoupper($name)] = [
'value' => $language
->getId(),
'description' => $language
->getName(),
];
}
return $values;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheablePluginTrait:: |
protected | function | ||
DescribablePluginTrait:: |
protected | function | ||
EnumPluginBase:: |
protected | function | Builds the description of an enum item. | |
EnumPluginBase:: |
protected | function | Builds the value of an enum item. | |
EnumPluginBase:: |
public static | function |
Overrides TypePluginInterface:: |
|
EnumPluginBase:: |
public | function |
Returns the plugin's type or field definition for the schema. Overrides TypePluginInterface:: |
|
LanguageId:: |
protected | property | The language manager. | |
LanguageId:: |
public | function |
Builds the enum values. Overrides EnumPluginBase:: |
|
LanguageId:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
LanguageId:: |
public | function |
LanguageId constructor. Overrides PluginBase:: |
|
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. |