- Issue created by @kkli2e
I have a multilingual website using the Search API with Solr for views. I can't find where to translate the default value for the search input.
In the SearchApiFulltext.php file, I tried updating line 303 from '#default_value' => $this->value to '#default_value' => $this->t($this->value). However, this resulted in a memory overflow, and the translation didn't work. Does anyone have any ideas on how to resolve this? Many thanks in advance!
// modules > contrib > search_api > src > Plugin > views > filter > SearchApiFulltext.php
protected function valueForm(&$form, FormStateInterface $form_state) {
parent::valueForm($form, $form_state);
$exposed = (bool) $form_state->get('exposed');
$max_length = NULL;
if ($exposed && $this->options['expose']['value_maxlength']) {
$max_length = $this->options['expose']['value_maxlength'];
}
$form['value'] = [
'#type' => 'textfield',
'#title' => !$exposed ? $this->t('Value') : '',
'#size' => 30,
'#default_value' => $this->value,
'#maxlength' => $max_length,
];
if (!empty($this->options['expose']['placeholder'])) {
$form['value']['#attributes']['placeholder'] = $this->options['expose']['placeholder'];
}
}
Needs work
1.35
Plugins