From 18e34acffb2f41c2dbbb56ef6149a1a4ad782f1b Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Fri, 11 Aug 2023 11:18:34 +0800 Subject: [PATCH] MDL-78983 core: Fix question mark icon direction flipping This fixes the changes made in MDL-75047: * Change `thisicondirection` langconfig string to a more specific one like `questionicondirection`. * Use existing direction string value `ltr` for the value of `questionicondirection`. Also add a comment to at least provide some form of documentation for it. * Improve the logic for applying the horizontal flipping class for the question icon: - Check first if the icon is a question icon - Flip the icon if `questionicondirection` is set to `rtl`. --- lang/en/langconfig.php | 3 ++- lib/classes/output/icon_system_fontawesome.php | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lang/en/langconfig.php b/lang/en/langconfig.php index 71d0561021e..f30a6477ccf 100644 --- a/lang/en/langconfig.php +++ b/lang/en/langconfig.php @@ -41,6 +41,8 @@ $string['oldcharset'] = 'ISO-8859-1'; $string['parentlanguage'] = ''; $string['pm'] = 'pm'; $string['pmcaps'] = 'PM'; +// Direction of the question mark icon for this language. Set to 'rtl' if the language needs to display it in right-to-left. +$string['questionicondirection'] = 'ltr'; $string['strftimedate'] = '%d %B %Y'; $string['strftimedatemonthabbr'] = '%d %b %Y'; $string['strftimedatemonthtimeshort'] = '%d %b %Y, %I:%M'; @@ -64,7 +66,6 @@ $string['strftimetime12'] = '%I:%M %p'; $string['strftimetime24'] = '%H:%M'; $string['thisdirection'] = 'ltr'; $string['thisdirectionvertical'] = 'btt'; -$string['thisicondirection'] = 'standard'; $string['thislanguage'] = 'English'; $string['thislanguageint'] = 'English'; $string['thousandssep'] = ','; diff --git a/lib/classes/output/icon_system_fontawesome.php b/lib/classes/output/icon_system_fontawesome.php index e463944a1c5..44c25e1c816 100644 --- a/lib/classes/output/icon_system_fontawesome.php +++ b/lib/classes/output/icon_system_fontawesome.php @@ -502,9 +502,8 @@ class icon_system_fontawesome extends icon_system_font { $data['aria-hidden'] = $icon->attributes['aria-hidden']; } - // Define the orientation of the question mark in right-to-left languages. - $mirror = get_string('thisicondirection', 'langconfig'); - if ($mirror == 'mirror' && (strpos($data['key'], 'fa-question') !== false)) { + // Flip the orientation of the question mark if the value of the `questionicondirection` lang config string is set to `rtl`. + if (strpos($data['key'], 'fa-question') !== false && get_string('questionicondirection', 'langconfig') === 'rtl') { $data['extraclasses'] = "fa-flip-horizontal"; }