extract ThemeInfo methods into AppHelper

pull/14542/head
Art4 2024-11-08 11:05:02 +00:00
parent 6fd74bccb0
commit 0fc9f7f0b4
2 changed files with 36 additions and 12 deletions

View File

@ -51,13 +51,6 @@ class App
const CODENAME = 'Yellow Archangel';
const VERSION = '2024.09-dev';
// Allow themes to control internal parameters
// by changing App values in theme.php
private $theme_info = [
'videowidth' => 425,
'videoheight' => 350,
];
/**
* @var Mode The Mode of the Application
*/
@ -220,19 +213,28 @@ class App
return $this->appHelper->getQueueValue($index);
}
/**
* @deprecated 2024.12 Use AppHelper::setThemeInfoValue() instead
*/
public function setThemeInfoValue(string $index, $value)
{
$this->theme_info[$index] = $value;
$this->appHelper->setThemeInfoValue($index, $value);
}
/**
* @deprecated 2024.12 Use AppHelper::getThemeInfo() instead
*/
public function getThemeInfo()
{
return $this->theme_info;
return $this->appHelper->getThemeInfo();
}
/**
* @deprecated 2024.12 Use AppHelper::getThemeInfoValue() instead
*/
public function getThemeInfoValue(string $index, $default = null)
{
return $this->theme_info[$index] ?? $default;
return $this->appHelper->getThemeInfoValue($index, $default);
}
/**

View File

@ -45,6 +45,13 @@ final class AppHelper
/** @var string The name of the current mobile theme */
private $currentMobileTheme;
// Allow themes to control internal parameters
// by changing App values in theme.php
private $theme_info = [
'videowidth' => 425,
'videoheight' => 350,
];
/**
* @var Database The Friendica database connection
*/
@ -228,7 +235,7 @@ final class AppHelper
*
* @param string $theme Name of current theme
*/
public function setCurrentTheme(string $theme)
public function setCurrentTheme(string $theme): void
{
$this->currentTheme = $theme;
}
@ -238,11 +245,26 @@ final class AppHelper
*
* @param string $theme Name of current mobile theme
*/
public function setCurrentMobileTheme(string $theme)
public function setCurrentMobileTheme(string $theme): void
{
$this->currentMobileTheme = $theme;
}
public function setThemeInfoValue(string $index, $value): void
{
$this->theme_info[$index] = $value;
}
public function getThemeInfo(): array
{
return $this->theme_info;
}
public function getThemeInfoValue(string $index, $default = null)
{
return $this->theme_info[$index] ?? $default;
}
/**
* Computes the current theme name based on the node settings, the page owner settings and the user settings
*