PersonalSection.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 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 PersonalSection implements IIconSection {
  11. /** @var string */
  12. protected $appName;
  13. /** @var IURLGenerator */
  14. private $urlGenerator;
  15. /** @var IL10N */
  16. private $l;
  17. /**
  18. * Personal Section constructor.
  19. *
  20. * @param string $appName
  21. * @param IURLGenerator $urlGenerator
  22. * @param IL10N $l
  23. */
  24. public function __construct(string $appName,
  25. IURLGenerator $urlGenerator,
  26. IL10N $l) {
  27. $this->appName = $appName;
  28. $this->urlGenerator = $urlGenerator;
  29. $this->l = $l;
  30. }
  31. /**
  32. * returns the relative path to an 16*16 icon describing the section.
  33. * e.g. '/core/img/places/files.svg'
  34. *
  35. * @returns string
  36. * @since 13.0.0
  37. */
  38. public function getIcon() {
  39. return $this->urlGenerator->imagePath($this->appName, 'accessibility-dark.svg');
  40. }
  41. /**
  42. * returns the ID of the section. It is supposed to be a lower case string,
  43. * e.g. 'ldap'
  44. *
  45. * @returns string
  46. * @since 9.1
  47. */
  48. public function getID() {
  49. return $this->appName;
  50. }
  51. /**
  52. * returns the translated name as it should be displayed, e.g. 'LDAP / AD
  53. * integration'. Use the L10N service to translate it.
  54. *
  55. * @return string
  56. * @since 9.1
  57. */
  58. public function getName() {
  59. return $this->l->t('Appearance and accessibility');
  60. }
  61. /**
  62. * @return int whether the form should be rather on the top or bottom of
  63. * the settings navigation. The sections are arranged in ascending order of
  64. * the priority values. It is required to return a value between 0 and 99.
  65. *
  66. * E.g.: 70
  67. * @since 9.1
  68. */
  69. public function getPriority() {
  70. return 15;
  71. }
  72. }