You are here

protected function FieldPluginBase::isLanguageAwareField in GraphQL 8.3

Indicator if the field is language aware.

Checks for 'languages:*' cache contexts on the fields definition.

Return value

bool The fields language awareness status.

1 call to FieldPluginBase::isLanguageAwareField()
FieldPluginBase::resolveDeferred in src/Plugin/GraphQL/Fields/FieldPluginBase.php
1 method overrides FieldPluginBase::isLanguageAwareField()
Route::isLanguageAwareField in modules/graphql_core/src/Plugin/GraphQL/Fields/Routing/Route.php
Route field is always language aware since it sets it's context from the prefix.

File

src/Plugin/GraphQL/Fields/FieldPluginBase.php, line 141

Class

FieldPluginBase

Namespace

Drupal\graphql\Plugin\GraphQL\Fields

Code

protected function isLanguageAwareField() {
  if (is_null($this->isLanguageAware)) {
    $this->isLanguageAware = (bool) count(array_filter($this
      ->getPluginDefinition()['response_cache_contexts'], function ($context) {
      return strpos($context, 'languages:') === 0;
    }));
  }
  return $this->isLanguageAware;
}