Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[new_timepoint] only show null language option when multiple exist #8253

Merged
merged 9 commits into from
Dec 20, 2022
4 changes: 3 additions & 1 deletion modules/create_timepoint/jsx/createTimepointIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ class CreateTimepoint extends React.Component {
/>
) : null;
// Include languages select.
const emptyLangOption =
Object.keys(this.state.form.options.languages).length > 1;
const languages = this.state.form.display.languages ? (
<SelectElement
id={'languageID'}
Expand All @@ -409,7 +411,7 @@ class CreateTimepoint extends React.Component {
value={this.state.form.value.languages}
options={this.state.form.options.languages}
onUserInput={this.setForm}
emptyOption={true}
emptyOption={emptyLangOption}
disabled={false}
autoSelect={true}
required={this.state.form.options.required.languages}
Expand Down
6 changes: 1 addition & 5 deletions modules/create_timepoint/php/timepoint.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,7 @@ class Timepoint extends \NDB_Page implements ETagCalculator
$values['visitGroups'] = $visitGroups;

// List languages
$languages = \Utility::getLanguageList();
if (count($languages) > 1) {
$languages = [null] + $languages;
}
$values['languages'] = $languages;
$values['languages'] = \Utility::getLanguageList();

if (!empty($conflict)) {
return new \LORIS\Http\Response\JSON\Conflict(
Expand Down