Skip to content

Commit

Permalink
pkp#10616 Add ThemePlugin function to get localized theme option value
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr committed Nov 15, 2024
1 parent 9c20b9e commit c195f01
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions classes/plugins/ThemePlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,22 @@ public function getOption($name) {
return isset($option->default) ? $option->default : null;
}

/**
* Get the localized value of an option
*
* @param string $name The name of the option
* @param string $localeKey (Optional) Get the value for a specific locale.
* If unset, it will return the current locale
*/
public function getLocalizedOption($name, $localeKey = null)
{
$localeKey = $localeKey ?? AppLocale::getLocale();
$value = $this->getOption($name);
return is_array($value) && isset($value[$localeKey])
? $value[$localeKey]
: null;
}

/**
* Get an option's configuration settings
*
Expand Down

0 comments on commit c195f01

Please sign in to comment.