You are here

public function TranslationTargetLanguageFilter::buildExposeForm in Translation Views 8

Options form subform for exposed filter options.

Overrides FilterPluginBase::buildExposeForm

See also

buildOptionsForm()

File

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

Class

TranslationTargetLanguageFilter
Provides filtering by translation target language.

Namespace

Drupal\translation_views\Plugin\views\filter

Code

public function buildExposeForm(&$form, FormStateInterface $form_state) {
  parent::buildExposeForm($form, $form_state);
  $form['expose']['multiple'] = [
    '#type' => 'hidden',
    '#value' => FALSE,
  ];
  $form['expose']['required'] = [
    '#type' => 'hidden',
    '#value' => TRUE,
  ];
  if ($this->translatorsContent) {

    // We need to force this option to allow users to use only the languages,
    // specified as the user's translation skills.
    $form['expose']['reduce']['#default_value'] = TRUE;
    $form['expose']['reduce']['#disabled'] = TRUE;
  }
  $form['expose']['identifier'] = [
    '#type' => 'hidden',
    '#value' => static::$targetExposedKey,
  ];
}