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`.
This commit is contained in:
Jun Pataleta
2023-08-11 11:48:02 +08:00
parent 571777775e
commit 18e34acffb
2 changed files with 4 additions and 4 deletions
@@ -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";
}