public function TranslationTargetLanguageFilter::buildOptionsForm in Translation Views 8
Provide the basic form which calls through to subforms. If overridden, it is best to call through to the parent, or to at least make sure all of the functions in this form are called.
Overrides FilterPluginBase::buildOptionsForm
File
- src/
Plugin/ views/ filter/ TranslationTargetLanguageFilter.php, line 138
Class
- TranslationTargetLanguageFilter
- Provides filtering by translation target language.
Namespace
Drupal\translation_views\Plugin\views\filterCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['remove'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Remove rows where language equals target language.'),
'#default_value' => $this->options['remove'],
'#weight' => -50,
];
// Build values list independently in order to see all the options.
$form['value']['#options'] = $this
->listLanguages(LanguageInterface::STATE_CONFIGURABLE | LanguageInterface::STATE_SITE_DEFAULT | PluginBase::INCLUDE_NEGOTIATED);
if ($this->translatorsContent) {
$end = $form['clear_markup_end'];
unset($form['clear_markup_end']);
$form['limit'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Limit target languages by translation skills'),
'#required' => FALSE,
'#default_value' => $this->options['limit'],
];
$form['column'] = [
'#type' => 'checkboxes',
'#options' => [
'source' => $this
->t('Source languages'),
'target' => $this
->t('Target languages'),
],
'#title' => $this
->t('Translation skill'),
'#required' => TRUE,
'#default_value' => $this->options['column'],
'#states' => [
'visible' => [
'input[name="options[limit]"]' => [
'checked' => TRUE,
],
],
],
];
$form['clear_markup_end'] = $end;
$form['value']['#prefix'] = '<div class="views-group-box views-right-60">';
}
}