IDeclarativeSettingsForm.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Settings;
  8. /**
  9. * @since 29.0.0
  10. *
  11. * @psalm-type DeclarativeSettingsSectionType = 'admin'|'personal'
  12. *
  13. * @psalm-type DeclarativeSettingsStorageType = 'internal'|'external'
  14. *
  15. * @psalm-type DeclarativeSettingsValueTypes = string|int|float|bool|list<string>
  16. *
  17. * @psalm-type DeclarativeSettingsFormField = array{
  18. * id: string,
  19. * title: string,
  20. * description?: string,
  21. * type: 'text'|'password'|'email'|'tel'|'url'|'number'|'checkbox'|'multi-checkbox'|'radio'|'select'|'multi-select',
  22. * placeholder?: string,
  23. * label?: string,
  24. * default: mixed,
  25. * options?: list<string|array{name: string, value: mixed}>,
  26. * }
  27. *
  28. * @psalm-type DeclarativeSettingsFormFieldWithValue = DeclarativeSettingsFormField&array{
  29. * value: DeclarativeSettingsValueTypes,
  30. * }
  31. *
  32. * @psalm-type DeclarativeSettingsFormSchema = array{
  33. * id: string,
  34. * priority: int,
  35. * section_type: DeclarativeSettingsSectionType,
  36. * section_id: string,
  37. * storage_type: DeclarativeSettingsStorageType,
  38. * title: string,
  39. * description?: string,
  40. * doc_url?: string,
  41. * }
  42. *
  43. * @psalm-type DeclarativeSettingsFormSchemaWithValues = DeclarativeSettingsFormSchema&array{
  44. * app: string,
  45. * fields: list<DeclarativeSettingsFormFieldWithValue>,
  46. * }
  47. *
  48. * @psalm-type DeclarativeSettingsFormSchemaWithoutValues = DeclarativeSettingsFormSchema&array{
  49. * fields: list<DeclarativeSettingsFormField>,
  50. * }
  51. */
  52. interface IDeclarativeSettingsForm {
  53. /**
  54. * Gets the schema that defines the declarative settings form
  55. *
  56. * @return DeclarativeSettingsFormSchemaWithoutValues
  57. * @since 29.0.0
  58. */
  59. public function getSchema(): array;
  60. }