Description
This solution is for changing the label of one of the available operators in an exposed view form.
As far as I can tell, changing this isn't possible from the view edit page or any view hook.
The achieve this, I used the form_alter hook, like so:
/**
* Implements hook_form_alter().
*
* change the filter data types.
*/
function MODULE_NAME_form_alter(
&$form,
FormStateInterface $form_state,
$form_id
) {
if ($form_id == '$FORM_ID' && $form['#id'] == '$ANOTHER_FORM_ID') {
$form['$FILTER_WRAPPER']['$FILTER']['#options']['$OPERATOR'] = t('$YOUR_NEW_LABEL');
}
}
$FORM_ID signifies the view type and is likely to be "views_exposed_form".
$ANOTHER_FORM_ID contains the form type, view id and display id at time of writing.
$FILTER_WRAPPER may or may not be necessary. Online guides didn't mention it but I did need to use it.