PersonalSection.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
  4. *
  5. * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. namespace OCA\Accessibility\Settings;
  24. use OCP\IL10N;
  25. use OCP\IURLGenerator;
  26. use OCP\Settings\IIconSection;
  27. class PersonalSection implements IIconSection {
  28. /** @var string */
  29. protected $appName;
  30. /** @var IURLGenerator */
  31. private $urlGenerator;
  32. /** @var IL10N */
  33. private $l;
  34. /**
  35. * Personal Section constructor.
  36. *
  37. * @param string $appName
  38. * @param IURLGenerator $urlGenerator
  39. * @param IL10N $l
  40. */
  41. public function __construct(string $appName,
  42. IURLGenerator $urlGenerator,
  43. IL10N $l) {
  44. $this->appName = $appName;
  45. $this->urlGenerator = $urlGenerator;
  46. $this->l = $l;
  47. }
  48. /**
  49. * returns the relative path to an 16*16 icon describing the section.
  50. * e.g. '/core/img/places/files.svg'
  51. *
  52. * @returns string
  53. * @since 13.0.0
  54. */
  55. public function getIcon() {
  56. return $this->urlGenerator->imagePath($this->appName, 'app-dark.svg');
  57. }
  58. /**
  59. * returns the ID of the section. It is supposed to be a lower case string,
  60. * e.g. 'ldap'
  61. *
  62. * @returns string
  63. * @since 9.1
  64. */
  65. public function getID() {
  66. return $this->appName;
  67. }
  68. /**
  69. * returns the translated name as it should be displayed, e.g. 'LDAP / AD
  70. * integration'. Use the L10N service to translate it.
  71. *
  72. * @return string
  73. * @since 9.1
  74. */
  75. public function getName() {
  76. return $this->l->t('Accessibility');
  77. }
  78. /**
  79. * @return int whether the form should be rather on the top or bottom of
  80. * the settings navigation. The sections are arranged in ascending order of
  81. * the priority values. It is required to return a value between 0 and 99.
  82. *
  83. * E.g.: 70
  84. * @since 9.1
  85. */
  86. public function getPriority() {
  87. return 15;
  88. }
  89. }