class ThunderEntityList in Thunder 6.2.x
The entity list producer class.
Plugin annotation
@DataProducer(
id = "thunder_entity_list",
name = @Translation("Entity list"),
description = @Translation("Loads a list of entities."),
produces = @ContextDefinition("any",
label = @Translation("Entity list")
),
consumes = {
"type" = @ContextDefinition("string",
label = @Translation("Entity type")
),
"bundles" = @ContextDefinition("any",
label = @Translation("Entity bundles"),
multiple = TRUE,
required = FALSE,
default_value = {}
),
"offset" = @ContextDefinition("integer",
label = @Translation("Offset"),
required = FALSE,
default_value = 0
),
"limit" = @ContextDefinition("integer",
label = @Translation("Limit"),
required = FALSE,
default_value = 100
),
"conditions" = @ContextDefinition("any",
label = @Translation("Filter conditions"),
multiple = FALSE,
required = FALSE,
default_value = {}
),
"languages" = @ContextDefinition("string",
label = @Translation("Entity languages"),
multiple = TRUE,
required = FALSE,
default_value = {}
),
"sortBy" = @ContextDefinition("any",
label = @Translation("Sorts"),
multiple = TRUE,
default_value = {},
required = FALSE
),
}
)
Hierarchy
- class \Drupal\thunder_gqls\Plugin\GraphQL\DataProducer\ThunderEntityListProducerBase extends \Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase implements ContainerFactoryPluginInterface
- class \Drupal\thunder_gqls\Plugin\GraphQL\DataProducer\ThunderEntityList
Expanded class hierarchy of ThunderEntityList
File
- modules/
thunder_gqls/ src/ Plugin/ GraphQL/ DataProducer/ ThunderEntityList.php, line 59
Namespace
Drupal\thunder_gqls\Plugin\GraphQL\DataProducerView source
class ThunderEntityList extends ThunderEntityListProducerBase {
/**
* Resolve entity query.
*
* @param string $type
* Entity type.
* @param string[] $bundles
* List of bundles to be filtered.
* @param int $offset
* Query only entities owned by current user.
* @param int $limit
* Maximum number of queried entities.
* @param array $conditions
* List of conditions to filter the entities.
* @param string[] $languages
* Languages for queried entities.
* @param array $sortBy
* List of sorts.
* @param \Drupal\graphql\GraphQL\Execution\FieldContext $cacheContext
* The caching context related to the current field.
*
* @return \Drupal\thunder_gqls\Wrappers\EntityListResponse
* Base entity list response.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
protected function resolve(string $type, array $bundles, int $offset, int $limit, array $conditions, array $languages, array $sortBy, FieldContext $cacheContext) : EntityListResponse {
$query = $this
->query($type, $bundles, $offset, $limit, $conditions, $languages, $sortBy, $cacheContext);
return new EntityListResponse($query);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ThunderEntityList:: |
protected | function | Resolve entity query. | |
ThunderEntityListProducerBase:: |
protected | property | The current user. | |
ThunderEntityListProducerBase:: |
protected | property | The entity type manager service. | |
ThunderEntityListProducerBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
ThunderEntityListProducerBase:: |
constant | |||
ThunderEntityListProducerBase:: |
protected | function | Build base entity query which may be reused for count query as well. | |
ThunderEntityListProducerBase:: |
public | function | EntityLoad constructor. |