plugin.yaml.twig 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. title: '{{ component.flex_name|capitalize }}'
  2. description: '{{ component.flex_name|capitalize }}'
  3. type: flex-objects
  4. # Flex Configuration
  5. config:
  6. # Administration Configuration
  7. admin:
  8. # Admin router (optional)
  9. router:
  10. path: '/{{ component.flex_name|lower|underscorize }}'
  11. # Admin menu (optional)
  12. menu:
  13. list:
  14. route: '/{{ component.flex_name|lower|underscorize }}'
  15. title: '{{ component.flex_name|capitalize }}'
  16. icon: fa-address-card-o
  17. # Authorization to collection admin
  18. authorize: ['admin.{{ component.flex_name|lower|underscorize }}.list', 'admin.super']
  19. # Priority -10 .. 10 (highest goes up)
  20. priority: 2
  21. # Admin template type / folder
  22. template: default
  23. # Permissions
  24. permissions:
  25. # Primary permissions
  26. admin.{{ component.flex_name|lower|underscorize }}:
  27. type: crudpl
  28. label: '{{ component.flex_name|capitalize }}'
  29. # List view
  30. list:
  31. title: name
  32. fields:
  33. published:
  34. field:
  35. type: toggle
  36. label: Published
  37. width: 8
  38. name:
  39. link: edit
  40. description:
  41. # Edit View
  42. edit:
  43. title:
  44. template: '{{ object.name }}'
  45. # Preview View
  46. preview:
  47. enabled: false
  48. route:
  49. #template: '/plugins/flex-objects/directory:contacts'
  50. # Data Export
  51. export:
  52. enabled: true
  53. method: 'jsonSerialize'
  54. formatter:
  55. class: 'Grav\Framework\File\Formatter\YamlFormatter'
  56. filename: '{{ component.flex_name|lower|underscorize }}'
  57. # Site Configuration
  58. site:
  59. templates:
  60. collection:
  61. # Lookup for the template layout files for collections of objects
  62. paths:
  63. - 'flex/{TYPE}/collection/{LAYOUT}{EXT}'
  64. object:
  65. # Lookup for the template layout files for objects
  66. paths:
  67. - 'flex/{TYPE}/object/{LAYOUT}{EXT}'
  68. defaults:
  69. # Default template {TYPE}; overridden by filename of this blueprint if template folder exists
  70. type: '{{ component.flex_name|lower|underscorize }}'
  71. # Default template {LAYOUT}; can be overridden in render calls (usually Twig in templates)
  72. layout: default
  73. # Data Configuration
  74. data:
  75. # Object class to be used, allowing custom methods for the object
  76. object: 'Grav\Plugin\{{ component.name|camelize }}\Flex\Types\{{ component.flex_name|camelize }}\{{ component.flex_name|camelize }}Object'
  77. # Collection class to be used, allowing custom methods for the collections
  78. collection: 'Grav\Plugin\{{ component.name|camelize }}\Flex\Types\{{ component.flex_name|camelize }}\{{ component.flex_name|camelize }}Collection'
  79. # Index class to be used, works as a quick database-like lookup index
  80. index: 'Grav\Common\Flex\Types\Generic\GenericIndex'
  81. storage:
  82. # Storage class, use single file storage (does not support images and assets)
  83. class: 'Grav\Framework\Flex\Storage\{{ component.flex_storage|capitalize }}Storage'
  84. options:
  85. formatter:
  86. # File formatter class, in this case the file is stored in markdown
  87. class: 'Grav\Framework\File\Formatter\JsonFormatter'
  88. # JSON file where all the objects will be stored
  89. folder: user-data://{{ component.flex_name|underscorize }}
  90. search:
  91. # Search options
  92. options:
  93. contains: 1
  94. # Fields to be searched
  95. fields:
  96. - name
  97. - description
  98. form:
  99. validation: loose
  100. fields:
  101. published:
  102. type: toggle
  103. label: Published
  104. highlight: 1
  105. default: 1
  106. options:
  107. 1: PLUGIN_ADMIN.YES
  108. 0: PLUGIN_ADMIN.NO
  109. validate:
  110. type: bool
  111. required: true
  112. name:
  113. type: text
  114. label: Name
  115. validate:
  116. required: true
  117. description:
  118. type: text
  119. label: Description
  120. validate:
  121. required: true