languageManager = $language_manager; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $configuration, $plugin_id, $plugin_definition, $container->get('language_manager') ); } /** * {@inheritdoc} */ public function getValueOptions() { if (!isset($this->valueOptions)) { $this->valueTitle = $this->t('Language'); // Pass the current values so options that are already selected do not get // lost when there are changes in the language configuration. $this->valueOptions = $this->listLanguages(LanguageInterface::STATE_ALL | LanguageInterface::STATE_SITE_DEFAULT | PluginBase::INCLUDE_NEGOTIATED, array_keys($this->value)); } return $this->valueOptions; } /** * {@inheritdoc} */ public function query() { // Don't filter by language in case the site is not multilingual, because // there is no point in doing so. if (!$this->languageManager->isMultilingual()) { return; } parent::query(); } }