Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2022
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.34 KB | None | 0 0
  1. <?php
  2. add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
  3.  
  4. function your_prefix_function_name( $meta_boxes ) {
  5. $prefix = '';
  6.  
  7. $meta_boxes[] = [
  8. 'title' => __( 'Policy Fields', 'your-text-domain' ),
  9. 'id' => 'policy-fields',
  10. 'post_types' => ['policy'],
  11. 'storage_type' => 'custom_table',
  12. 'table' => 'wpgw_policy_meta',
  13. 'fields' => [
  14. [
  15. 'type' => 'heading',
  16. 'name' => __( 'Policy', 'your-text-domain' ),
  17. ],
  18. [
  19. 'name' => __( 'Policy Name', 'your-text-domain' ),
  20. 'id' => $prefix . 'policy_name',
  21. 'type' => 'text',
  22. 'label_description' => __( 'What is the name of this policy?', 'your-text-domain' ),
  23. 'desc' => __( 'This could be as simple as \'X org\'s annual leave policy\' or could be something more creative, if you\'ve got a working title that captures what you\'re trying to achieve.', 'your-text-domain' ),
  24. 'required' => true,
  25. ],
  26. [
  27. 'name' => __( 'Policy Type', 'your-text-domain' ),
  28. 'id' => $prefix . 'taxonomy_policy_type',
  29. 'type' => 'taxonomy',
  30. 'taxonomy' => ['policy-type'],
  31. 'field_type' => 'checkbox_list',
  32. 'admin_columns' => 'after title',
  33. 'hide_from_front' => true,
  34. ],
  35. [
  36. 'name' => __( 'Policy Summary', 'your-text-domain' ),
  37. 'id' => $prefix . 'policy_summary',
  38. 'type' => 'textarea',
  39. 'label_description' => __( 'Can you give us a 2-3 sentence summary of what this policy is, what it’s trying to do, and what makes it different from more mainstream policies? (For example: ‘This is a pay policy that aims to recognise staff members’ time as equal, while acknowledging that different people will have different financial needs, based on their individual circumstances and wider systemic issues.’).', 'your-text-domain' ),
  40. ],
  41. [
  42. 'name' => __( 'Policy Text', 'your-text-domain' ),
  43. 'id' => $prefix . 'policy_text',
  44. 'type' => 'wysiwyg',
  45. 'label_description' => __( 'If you can add the text of the policy below (and even format it!) that really helps us and increases the accessibility of the policy to community members. But if you can\'t do that, for whatever reason, please upload the policy as a file below or add a link to where we can find the document. Whatever option you choose, we may mean we do some formatting. If you have any issues, concerns or questions, <a href="https://radhr.org/contact" target="_blank">contact us</a>!', 'your-text-domain' ),
  46. 'options' => [
  47. 'media_buttons' => false,
  48. ],
  49. ],
  50. [
  51. 'name' => __( 'Files', 'your-text-domain' ),
  52. 'id' => $prefix . 'files',
  53. 'type' => 'file_upload',
  54. 'label_description' => __( 'If the policy is already online somewhere, you can instead add a link to the box area...', 'your-text-domain' ),
  55. ],
  56. [
  57. 'type' => 'heading',
  58. 'name' => __( 'Organisation', 'your-text-domain' ),
  59. ],
  60. [
  61. 'name' => __( 'Uploaded Before', 'your-text-domain' ),
  62. 'id' => $prefix . 'org_previous',
  63. 'type' => 'radio',
  64. 'label_description' => __( 'Have you uploaded a policy for this group/org before?', 'your-text-domain' ),
  65. 'options' => [
  66. 'yes' => __( 'Yes', 'your-text-domain' ),
  67. 'no' => __( 'No', 'your-text-domain' ),
  68. ],
  69. 'std' => 'no',
  70. 'inline' => false,
  71. ],
  72. [
  73. 'name' => __( 'Org Name', 'your-text-domain' ),
  74. 'id' => $prefix . 'org_name',
  75. 'type' => 'text',
  76. 'label_description' => __( 'What is the organisation / group called?', 'your-text-domain' ),
  77. ],
  78. [
  79. 'name' => __( 'Org Website', 'your-text-domain' ),
  80. 'id' => $prefix . 'org-url',
  81. 'type' => 'url',
  82. 'label_description' => __( 'Please add a link to your organisation\'s website if you have one.', 'your-text-domain' ),
  83. ],
  84. [
  85. 'name' => __( 'Org Size', 'your-text-domain' ),
  86. 'id' => $prefix . 'taxonomy_org_size',
  87. 'type' => 'taxonomy',
  88. 'label_description' => __( 'How many people are there in your organisation?', 'your-text-domain' ),
  89. 'desc' => __( 'In terms of active members or staff...', 'your-text-domain' ),
  90. 'taxonomy' => ['org-size'],
  91. 'field_type' => 'radio_list',
  92. 'remove_default' => true,
  93. 'required' => true,
  94. ],
  95. [
  96. 'name' => __( 'Org Turnover', 'your-text-domain' ),
  97. 'id' => $prefix . 'taxonomy_org_turnover',
  98. 'type' => 'taxonomy',
  99. 'label_description' => __( 'What is your organisation\'s turnover or income? ', 'your-text-domain' ),
  100. 'taxonomy' => ['org-turnover'],
  101. 'field_type' => 'radio_list',
  102. 'remove_default' => true,
  103. 'hidden' => [
  104. 'when' => [['org_previous', '=', 'Yes']],
  105. 'relation' => 'or',
  106. ],
  107. ],
  108. [
  109. 'name' => __( 'Org Type', 'your-text-domain' ),
  110. 'id' => $prefix . 'taxonomy_org_type',
  111. 'type' => 'taxonomy',
  112. 'label_description' => __( 'What type of organisation is it? You can check more than one...', 'your-text-domain' ),
  113. 'taxonomy' => ['org-type'],
  114. 'field_type' => 'checkbox_list',
  115. 'remove_default' => true,
  116. 'required' => true,
  117. ],
  118. [
  119. 'id' => $prefix . 'org_type_other',
  120. 'type' => 'text',
  121. 'placeholder' => __( 'Other...', 'your-text-domain' ),
  122. 'class' => 'other',
  123. 'hidden' => [
  124. 'when' => [['org_previous', '=', 'yes']],
  125. 'relation' => 'or',
  126. ],
  127. ],
  128. [
  129. 'name' => __( 'Org Structure', 'your-text-domain' ),
  130. 'id' => $prefix . 'taxonomy_org_structure',
  131. 'type' => 'taxonomy',
  132. 'label_description' => __( 'What is your organisation’s structure?', 'your-text-domain' ),
  133. 'taxonomy' => ['org-structure'],
  134. 'field_type' => 'radio_list',
  135. 'remove_default' => true,
  136. 'required' => true,
  137. ],
  138. [
  139. 'id' => $prefix . 'org_structure_other',
  140. 'type' => 'text',
  141. 'placeholder' => __( 'Other...', 'your-text-domain' ),
  142. 'class' => 'other',
  143. ],
  144. [
  145. 'type' => 'heading',
  146. 'name' => __( 'Categories & Tags', 'your-text-domain' ),
  147. ],
  148. [
  149. 'name' => __( 'Policy Categories', 'your-text-domain' ),
  150. 'id' => $prefix . 'taxonomy_traditional',
  151. 'type' => 'taxonomy',
  152. 'label_description' => __( 'Which categories do you think this policy fits in? Please tick any relevant categories.', 'your-text-domain' ),
  153. 'taxonomy' => ['traditional'],
  154. 'field_type' => 'checkbox_list',
  155. 'remove_default' => true,
  156. 'required' => true,
  157. 'class' => 'policy_categories',
  158. ],
  159. [
  160. 'id' => $prefix . 'category_other',
  161. 'type' => 'text',
  162. 'placeholder' => __( 'Other...', 'your-text-domain' ),
  163. 'class' => 'other',
  164. ],
  165. [
  166. 'name' => __( 'Policy Tags', 'your-text-domain' ),
  167. 'id' => $prefix . 'policy_tags',
  168. 'type' => 'taxonomy',
  169. 'label_description' => __( 'Are there any tags, themes or features that would help identify the policy?', 'your-text-domain' ),
  170. 'taxonomy' => ['policy-tag'],
  171. 'field_type' => 'checkbox_list',
  172. ],
  173. [
  174. 'id' => $prefix . 'tags_other',
  175. 'type' => 'text',
  176. 'placeholder' => __( 'Other...', 'your-text-domain' ),
  177. 'class' => 'other',
  178. ],
  179. [
  180. 'type' => 'heading',
  181. 'name' => __( 'Review', 'your-text-domain' ),
  182. ],
  183. [
  184. 'name' => __( 'Policy Review', 'your-text-domain' ),
  185. 'id' => $prefix . 'policy_review',
  186. 'type' => 'textarea',
  187. 'label_description' => __( 'Do you have any reflections on how this policy, process or structure has worked in practice? Any additional info or context? Are there any other useful elements about this policy that might help others to adapt it to their own groups or organisations, for example, any relevant group structures needed to implement the policy? Any notable processes that you went through to develop it, which feel important to the result? Any laws that are referenced that could change or have changed since you drafted it? Was it developed with any particular demographics of members or staff in mind?', 'your-text-domain' ),
  188. ],
  189. [
  190. 'name' => __( 'Policy Duration', 'your-text-domain' ),
  191. 'id' => $prefix . 'taxonomy_policy_duration',
  192. 'type' => 'taxonomy',
  193. 'label_description' => __( 'How long has this policy/process/structure been in use in your group or organisation?', 'your-text-domain' ),
  194. 'taxonomy' => ['policy-duration'],
  195. 'field_type' => 'radio_list',
  196. 'remove_default' => true,
  197. ],
  198. [
  199. 'type' => 'heading',
  200. 'name' => __( 'Legal', 'your-text-domain' ),
  201. ],
  202. [
  203. 'name' => __( 'Policy Legal Check', 'your-text-domain' ),
  204. 'id' => $prefix . 'taxonomy_legal',
  205. 'type' => 'taxonomy',
  206. 'label_description' => __( 'Has the policy been checked legally?', 'your-text-domain' ),
  207. 'taxonomy' => ['legal'],
  208. 'field_type' => 'radio_list',
  209. 'remove_default' => true,
  210. 'required' => true,
  211. ],
  212. [
  213. 'id' => $prefix . 'legal_other',
  214. 'type' => 'text',
  215. 'placeholder' => __( 'Other...', 'your-text-domain' ),
  216. 'class' => 'other',
  217. ],
  218. [
  219. 'name' => __( 'Policy Legal Advice', 'your-text-domain' ),
  220. 'id' => $prefix . 'policy_legal_advice',
  221. 'type' => 'textarea',
  222. 'label_description' => __( 'Could you share the legal advice?', 'your-text-domain' ),
  223. ],
  224. [
  225. 'type' => 'heading',
  226. 'name' => __( 'Community', 'your-text-domain' ),
  227. ],
  228. [
  229. 'name' => __( 'Policy Communication', 'your-text-domain' ),
  230. 'id' => $prefix . 'policy_communication',
  231. 'type' => 'radio',
  232. 'label_description' => __( 'Would you be happy to communicate with other RadHR community members about how this policy has worked for you?', 'your-text-domain' ),
  233. 'options' => [
  234. 'Yes' => __( 'Yes', 'your-text-domain' ),
  235. 'No' => __( 'No', 'your-text-domain' ),
  236. 'Not sure' => __( 'Not sure', 'your-text-domain' ),
  237. ],
  238. 'std' => 'Yes',
  239. 'inline' => false,
  240. ],
  241. [
  242. 'name' => __( 'Policy Derivative', 'your-text-domain' ),
  243. 'id' => $prefix . 'policy_derivative',
  244. 'type' => 'text',
  245. 'label_description' => __( 'Is this policy based on another RadHR policy?', 'your-text-domain' ),
  246. 'placeholder' => __( 'If yes, which one?', 'your-text-domain' ),
  247. ],
  248. [
  249. 'type' => 'heading',
  250. 'name' => __( 'Privacy', 'your-text-domain' ),
  251. ],
  252. [
  253. 'name' => __( 'Share Consent', 'your-text-domain' ),
  254. 'id' => $prefix . 'share_consent',
  255. 'type' => 'checkbox_list',
  256. 'label_description' => __( 'I am happy to share:', 'your-text-domain' ),
  257. 'options' => [
  258. 'This policy with the public, on the website' => __( 'This policy with the public, on the website', 'your-text-domain' ),
  259. 'This policy with RadHR community members' => __( 'This policy with RadHR community members', 'your-text-domain' ),
  260. 'The other info with the public, on the website' => __( 'The other info with the public, on the website', 'your-text-domain' ),
  261. 'The other info with RadHR community members' => __( 'The other info with RadHR community members', 'your-text-domain' ),
  262. ],
  263. 'std' => [
  264. 'This policy with the public, on the website',
  265. 'This policy with RadHR community members',
  266. 'The other info with the public, on the website',
  267. 'The other info with RadHR community members',
  268. ],
  269. ],
  270. [
  271. 'id' => $prefix . 'share_consent_other',
  272. 'type' => 'text',
  273. 'placeholder' => __( 'Other...', 'your-text-domain' ),
  274. 'class' => 'other',
  275. ],
  276. [
  277. 'name' => __( 'Share Opt-out', 'your-text-domain' ),
  278. 'id' => $prefix . 'share_optout',
  279. 'type' => 'textarea',
  280. 'label_description' => __( 'Is there anything in your answers in this form that you DO NOT want shared anywhere?', 'your-text-domain' ),
  281. ],
  282. [
  283. 'name' => __( 'Privacy Policy Consent', 'your-text-domain' ),
  284. 'id' => $prefix . 'privacy_policy_consent',
  285. 'type' => 'checkbox',
  286. 'label_description' => __( 'Please confirm...', 'your-text-domain' ),
  287. 'desc' => __( 'I have read & understood the privacy policy YADA YADA', 'your-text-domain' ),
  288. 'required' => true,
  289. ],
  290. ],
  291. ];
  292.  
  293. return $meta_boxes;
  294. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement