You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ITemplateManager.php 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2021 Julius Härtl <jus@bitgrid.net>
  4. *
  5. * @author Julius Härtl <jus@bitgrid.net>
  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. declare(strict_types=1);
  24. namespace OCP\Files\Template;
  25. use OCP\Files\GenericFileException;
  26. /**
  27. * @since 21.0.0
  28. */
  29. interface ITemplateManager {
  30. /**
  31. * Register a template type support
  32. *
  33. * @param TemplateFileCreator $templateType
  34. * @since 21.0.0
  35. */
  36. public function registerTemplateFileCreator(TemplateFileCreator $templateType): void;
  37. /**
  38. * Register a custom template provider class that is able to inject custom templates
  39. * in addition to the user defined ones
  40. *
  41. * @param string $providerClass
  42. * @since 21.0.0
  43. */
  44. public function registerTemplateProvider(string $providerClass): void;
  45. /**
  46. * Get a list of available file creators and their offered templates
  47. *
  48. * @return array
  49. * @since 21.0.0
  50. */
  51. public function listCreators(): array;
  52. /**
  53. * @return bool
  54. * @since 21.0.0
  55. */
  56. public function hasTemplateDirectory(): bool;
  57. /**
  58. * @param string $path
  59. * @return void
  60. * @since 21.0.0
  61. */
  62. public function setTemplatePath(string $path): void;
  63. /**
  64. * @return string
  65. * @since 21.0.0
  66. */
  67. public function getTemplatePath(): string;
  68. /**
  69. * @param string|null $path
  70. * @param string|null $userId
  71. * @since 21.0.0
  72. */
  73. public function initializeTemplateDirectory(string $path = null, string $userId = null): void;
  74. /**
  75. * @param string $filePath
  76. * @param string $templateId
  77. * @return array
  78. * @throws GenericFileException
  79. * @since 21.0.0
  80. */
  81. public function createFromTemplate(string $filePath, string $templateId = '', string $templateType = 'user'): array;
  82. }