Ajax callback to fetch the options for target language select.
array $form: The form.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
mixed Target language select array.
public function ajaxSourceLanguageSelect(array $form, FormStateInterface $form_state) {
if ($el = $form_state
->getTriggeringElement()['#value']) {
$selected_option = [
$el => tmgmt_available_languages()[$el],
];
$options = array_diff(tmgmt_available_languages(), $selected_option);
$form['info']['target_language']['#options'] = $options;
return $form['info']['target_language'];
}
}