AdminSection.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\Theming\Settings;
  7. use OCP\IL10N;
  8. use OCP\IURLGenerator;
  9. use OCP\Settings\IIconSection;
  10. class AdminSection implements IIconSection {
  11. private string $appName;
  12. private IL10N $l;
  13. private IURLGenerator $url;
  14. public function __construct(string $appName, IURLGenerator $url, IL10N $l) {
  15. $this->appName = $appName;
  16. $this->url = $url;
  17. $this->l = $l;
  18. }
  19. /**
  20. * returns the ID of the section. It is supposed to be a lower case string,
  21. * e.g. 'ldap'
  22. *
  23. * @returns string
  24. */
  25. public function getID() {
  26. return $this->appName;
  27. }
  28. /**
  29. * returns the translated name as it should be displayed, e.g. 'LDAP / AD
  30. * integration'. Use the L10N service to translate it.
  31. *
  32. * @return string
  33. */
  34. public function getName() {
  35. return $this->l->t('Theming');
  36. }
  37. /**
  38. * @return int whether the form should be rather on the top or bottom of
  39. * the settings navigation. The sections are arranged in ascending order of
  40. * the priority values. It is required to return a value between 0 and 99.
  41. *
  42. * E.g.: 70
  43. */
  44. public function getPriority() {
  45. return 30;
  46. }
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public function getIcon() {
  51. return $this->url->imagePath($this->appName, 'app-dark.svg');
  52. }
  53. }