You are here

public function TranslationTargetLanguageFilter::buildExposedForm in Translation Views 8

Render our chunk of the exposed filter form when selecting

You can override this if it doesn't do what you expect.

Overrides FilterPluginBase::buildExposedForm

File

src/Plugin/views/filter/TranslationTargetLanguageFilter.php, line 118

Class

TranslationTargetLanguageFilter
Provides filtering by translation target language.

Namespace

Drupal\translation_views\Plugin\views\filter

Code

public function buildExposedForm(&$form, FormStateInterface $form_state) {
  parent::buildExposedForm($form, $form_state);
  $field =& $form[$this->field];

  // Avoide validation error when list of allowed languages changes.
  if (isset($field['#value']) && !isset($field['#options'][$field['#value']])) {
    $field['#value'] = $field['#default_value'] = '';
  }

  // Show empty registered skills message inside this window.
  if ($this->translatorsContent && $this->options['limit'] && empty($this->translatorSkills
    ->getAllLangcodes())) {
    $field['#options'] = [
      'All' => $this
        ->t('- Any -'),
    ];
    $field['#value'] = $field['#default_value'] = 'All';
    $this->translatorSkills
      ->showMissingTranslationSkillsWarning();
  }
}