Skip to content

Commit 5412ca0

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

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Plugin/Preprocess/Html.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,21 @@ 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-
$variables['wxt_skip_link_primary_text'] = t($this->theme->getSetting('wxt_skip_link_primary_text'));
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+
}
3238
$variables['wxt_skip_link_secondary'] = $this->theme->getSetting('wxt_skip_link_secondary');
33-
$variables['wxt_skip_link_secondary_text'] = t($this->theme->getSetting('wxt_skip_link_secondary_text'));
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+
}
3446

3547
parent::preprocess($variables, $hook, $info);
3648
}

0 commit comments

Comments
 (0)