From 2ed6a57f36cd51434f9c22df4a9b53ede1463e92 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 7 May 2024 21:59:38 +0100 Subject: [PATCH] MDL-80344 calendar: correct no subscriptions language string use. Ensure expected parameters are present; avoid string concatenation. --- calendar/renderer.php | 8 ++++---- lang/en/calendar.php | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/calendar/renderer.php b/calendar/renderer.php index 5134fa007fa..3d184b83e21 100644 --- a/calendar/renderer.php +++ b/calendar/renderer.php @@ -298,9 +298,8 @@ class core_calendar_renderer extends plugin_renderer_base { */ public function render_no_calendar_subscriptions(): string { $output = html_writer::start_div('mt-5'); - $importlink = html_writer::link((new moodle_url('/calendar/import.php', calendar_get_export_import_link_params()))->out(), - get_string('importcalendarexternal', 'calendar')); - $output .= get_string('nocalendarsubscriptions', 'calendar', $importlink); + $importlink = (new moodle_url('/calendar/import.php', calendar_get_export_import_link_params()))->out(); + $output .= get_string('nocalendarsubscriptionsimportexternal', 'core_calendar', $importlink); $output .= html_writer::end_div(); return $output; @@ -327,7 +326,8 @@ class core_calendar_renderer extends plugin_renderer_base { $table->id = 'subscription_details_table'; if (empty($subscriptions)) { - $cell = new html_table_cell(get_string('nocalendarsubscriptions', 'calendar')); + $importlink = (new moodle_url('/calendar/import.php', calendar_get_export_import_link_params()))->out(); + $cell = new html_table_cell(get_string('nocalendarsubscriptionsimportexternal', 'core_calendar', $importlink)); $cell->colspan = 5; $table->data[] = new html_table_row(array($cell)); } diff --git a/lang/en/calendar.php b/lang/en/calendar.php index 5846cd1254d..d1980f78703 100644 --- a/lang/en/calendar.php +++ b/lang/en/calendar.php @@ -193,6 +193,7 @@ $string['namewithsource'] = '{$a->name} ({$a->source})'; $string['never'] = 'Never'; $string['newevent'] = 'New event'; $string['newmonthannouncement'] = 'Calendar is now set to {$a}.'; +$string['nocalendarsubscriptionsimportexternal'] = 'No calendar subscriptions yet. Import an external calendar'; $string['notitle'] = 'no title'; $string['noupcomingevents'] = 'There are no upcoming events'; $string['nocalendarsubscriptions'] = 'No calendar subscriptions yet. Do you want to {$a}';