Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors theming app - part 3 #45145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/theming/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
use OCP\Util;

class Admin implements IDelegatedSettings {

public function __construct(
private string $appName,
private IConfig $config,
Expand Down
25 changes: 9 additions & 16 deletions apps/theming/lib/Settings/AdminSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,26 @@
use OCP\Settings\IIconSection;

class AdminSection implements IIconSection {
private string $appName;
private IL10N $l;
private IURLGenerator $url;

public function __construct(string $appName, IURLGenerator $url, IL10N $l) {
$this->appName = $appName;
$this->url = $url;
$this->l = $l;
public function __construct(
private string $appName,
private IURLGenerator $url,
private IL10N $l,
) {
}

/**
* returns the ID of the section. It is supposed to be a lower case string,
* e.g. 'ldap'
*
* @returns string
*/
public function getID() {
public function getID(): string {
return $this->appName;
}

/**
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
* integration'. Use the L10N service to translate it.
*
* @return string
*/
public function getName() {
public function getName(): string {
return $this->l->t('Theming');
}

Expand All @@ -64,14 +57,14 @@ public function getName() {
*
* E.g.: 70
*/
public function getPriority() {
public function getPriority(): int {
return 30;
}

/**
* {@inheritdoc}
*/
public function getIcon() {
public function getIcon(): string {
return $this->url->imagePath($this->appName, 'app-dark.svg');
}
}
1 change: 0 additions & 1 deletion apps/theming/lib/Settings/Personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
use OCP\Util;

class Personal implements ISettings {

public function __construct(
protected string $appName,
private string $userId,
Expand Down
36 changes: 9 additions & 27 deletions apps/theming/lib/Settings/PersonalSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,61 +28,43 @@
use OCP\Settings\IIconSection;

class PersonalSection implements IIconSection {

/** @var string */
protected $appName;

/** @var IURLGenerator */
private $urlGenerator;

/** @var IL10N */
private $l;

/**
* Personal Section constructor.
*
* @param string $appName
* @param IURLGenerator $urlGenerator
* @param IL10N $l
*/
public function __construct(string $appName,
IURLGenerator $urlGenerator,
IL10N $l) {
$this->appName = $appName;
$this->urlGenerator = $urlGenerator;
$this->l = $l;
public function __construct(
protected string $appName,
private IURLGenerator $urlGenerator,
private IL10N $l,
) {
}

/**
* returns the relative path to an 16*16 icon describing the section.
* e.g. '/core/img/places/files.svg'
*
* @returns string
* @since 13.0.0
*/
public function getIcon() {
public function getIcon(): string {
return $this->urlGenerator->imagePath($this->appName, 'accessibility-dark.svg');
}

/**
* returns the ID of the section. It is supposed to be a lower case string,
* e.g. 'ldap'
*
* @returns string
* @since 9.1
*/
public function getID() {
public function getID(): string {
return $this->appName;
}

/**
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
* integration'. Use the L10N service to translate it.
*
* @return string
* @since 9.1
*/
public function getName() {
public function getName(): string {
return $this->l->t('Appearance and accessibility');
}

Expand All @@ -94,7 +76,7 @@ public function getName() {
* E.g.: 70
* @since 9.1
*/
public function getPriority() {
public function getPriority(): int {
return 15;
}
}
8 changes: 5 additions & 3 deletions apps/theming/lib/SetupChecks/PhpImagickModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ public function run(): SetupResult {
$this->l10n->t('The PHP module "imagick" is not enabled although the theming app is. For favicon generation to work correctly, you need to install and enable this module.'),
$this->urlGenerator->linkToDocs('admin-php-modules')
);
} elseif (count(\Imagick::queryFormats('SVG')) === 0) {
}

if (count(\Imagick::queryFormats('SVG')) === 0) {
return SetupResult::info(
$this->l10n->t('The PHP module "imagick" in this instance has no SVG support. For better compatibility it is recommended to install it.'),
$this->urlGenerator->linkToDocs('admin-php-modules')
);
} else {
return SetupResult::success();
}

return SetupResult::success();
}
}
Loading