Skip to content

Commit f47ba90

Browse files
joseph.olstadsylus
authored andcommitted
Issue #3210758 by joseph.olstad: Skip links theme configuration text is currently not translateable
1 parent 5412ca0 commit f47ba90

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/Plugin/Preprocess/Html.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,13 @@ public function preprocess(array &$variables, $hook, array $info) {
2828

2929
// Assign skip link variables.
3030
$variables['wxt_skip_link_primary'] = $this->theme->getSetting('wxt_skip_link_primary');
31-
if (empty($this->theme->getSetting('wxt_skip_link_primary_text'))) {
32-
// We cannot pass an empty string into the $this->t() function.
33-
$variables['wxt_skip_link_primary_text'] = '';
34-
}
35-
else {
36-
$variables['wxt_skip_link_primary_text'] = t($this->theme->getSetting('wxt_skip_link_primary_text'));
37-
}
31+
// For some reason getSetting sometimes returns an object.
32+
// Cast to (string) to make sure t() can handle it.
33+
$variables['wxt_skip_link_primary_text'] = $this->t((string)$this->theme->getSetting('wxt_skip_link_primary_text'));
3834
$variables['wxt_skip_link_secondary'] = $this->theme->getSetting('wxt_skip_link_secondary');
39-
if (empty($this->theme->getSetting('wxt_skip_link_secondary_text'))) {
40-
// We cannot pass an empty string into the $this->t() function.
41-
$variables['wxt_skip_link_secondary_text'] = '';
42-
}
43-
else {
44-
$variables['wxt_skip_link_secondary_text'] = t($this->theme->getSetting('wxt_skip_link_secondary_text'));
45-
}
35+
// For some reason getSetting sometimes returns an object.
36+
// Cast to (string) to make sure t() can handle it.
37+
$variables['wxt_skip_link_secondary_text'] = $this->t((string)$this->theme->getSetting('wxt_skip_link_secondary_text'));
4638

4739
parent::preprocess($variables, $hook, $info);
4840
}

0 commit comments

Comments
 (0)