GFPDFHelperHelper_Options_Fields

Class to set up the settings api fields.

Defined (1)

The class is defined in the following location(s).

/src/helper/Helper_Options_Fields.php  
  1. class Helper_Options_Fields extends Helper_Abstract_Options implements Helper_Interface_Filters { 
  2.  
  3. /** 
  4. * Add our filters 
  5. * @return void 
  6. * @since 4.0 
  7. */ 
  8. public function add_filters() { 
  9.  
  10. /** Conditionally enable specific fields */ 
  11. add_filter( 'gfpdf_form_settings_advanced', [ $this, 'get_advanced_template_field' ] ); 
  12.  
  13. parent::add_filters(); 
  14.  
  15. /** 
  16. * Retrieve the array of registered fields 
  17. * @since 4.0 
  18. * @return array 
  19. */ 
  20. public function get_registered_fields() { 
  21.  
  22. /** 
  23. * Gravity PDF settings 
  24. * Filters are provided for each settings section to allow extensions and other plugins to add their own option 
  25. * which will be processed by our settings API 
  26. */ 
  27. $gfpdf_settings = [ 
  28.  
  29. /** 
  30. * General Settings 
  31. * See https://gravitypdf.com/documentation/v4/gfpdf_settings_general/ for more details about this filter 
  32. */ 
  33. 'general' => apply_filters( 'gfpdf_settings_general',  
  34. 'default_pdf_size' => [ 
  35. 'id' => 'default_pdf_size',  
  36. 'name' => esc_html__( 'Default Paper Size', 'gravity-forms-pdf-extended' ),  
  37. 'desc' => esc_html__( 'Set the default paper size used when generating PDFs.', 'gravity-forms-pdf-extended' ),  
  38. 'type' => 'select',  
  39. 'options' => $this->get_paper_size(),  
  40. 'inputClass' => 'large',  
  41. 'chosen' => true,  
  42. 'class' => 'gfpdf_paper_size',  
  43. ],  
  44.  
  45. 'default_custom_pdf_size' => [ 
  46. 'id' => 'default_custom_pdf_size',  
  47. 'name' => esc_html__( 'Custom Paper Size', 'gravity-forms-pdf-extended' ),  
  48. 'desc' => esc_html__( 'Control the exact paper size. Can be set in millimeters or inches.', 'gravity-forms-pdf-extended' ),  
  49. 'type' => 'paper_size',  
  50. 'size' => 'small',  
  51. 'chosen' => true,  
  52. 'required' => true,  
  53. 'class' => 'gfpdf-hidden gfpdf_paper_size_other',  
  54. ],  
  55.  
  56. 'default_template' => [ 
  57. 'id' => 'default_template',  
  58. 'name' => esc_html__( 'Default Template', 'gravity-forms-pdf-extended' ),  
  59. 'desc' => sprintf( esc_html__( 'Choose an existing template or purchased more %sfrom our theme shop%s. You can also %sbuild your own%s or %shire us%s to create a custom solution.', 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/shop/">', '</a>', '<a href="https://gravitypdf.com/documentation/v4/developer-start-customising/">', '</a>', '<a href="https://gravitypdf.com/integration-services/">', '</a>' ),  
  60. 'type' => 'select',  
  61. 'options' => $this->templates->get_all_templates_by_group(),  
  62. 'std' => 'zadani',  
  63. 'inputClass' => 'large',  
  64. 'chosen' => true,  
  65. 'tooltip' => '<h6>' . esc_html__( 'Templates', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'Gravity PDF comes with %sfour completely-free and highly customizable designs%s. You can also purchase additional templates from our theme shop, hire us to integrate existing PDFs or, with a bit of technical know-how, build your own.', 'gravity-forms-pdf-extended' ), '<strong>', '</strong>' ),  
  66. ],  
  67.  
  68. 'default_font' => [ 
  69. 'id' => 'default_font',  
  70. 'name' => esc_html__( 'Default Font', 'gravity-forms-pdf-extended' ),  
  71. 'desc' => sprintf( esc_html__( 'Set the default font type used in PDFs. Choose an existing font or %sinstall your own%s.', 'gravity-forms-pdf-extended' ), '<a href="' . $this->data->settings_url . '&tab=tools#manage_fonts">', '</a>' ),  
  72. 'type' => 'select',  
  73. 'options' => $this->get_installed_fonts(),  
  74. 'inputClass' => 'large',  
  75. 'chosen' => true,  
  76. 'tooltip' => '<h6>' . esc_html__( 'Fonts', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'Gravity PDF comes bundled with fonts for most languages world-wide. Want to use a specific font type? Use the font installer (found in the Tools tab).', 'gravity-forms-pdf-extended' ),  
  77. ],  
  78.  
  79. 'default_font_size' => [ 
  80. 'id' => 'default_font_size',  
  81. 'name' => esc_html__( 'Default Font Size', 'gravity-forms-pdf-extended' ),  
  82. 'desc' => esc_html__( 'Set the default font size used in PDFs.', 'gravity-forms-pdf-extended' ),  
  83. 'desc2' => 'pt',  
  84. 'type' => 'number',  
  85. 'size' => 'small',  
  86. 'std' => 10,  
  87. ],  
  88.  
  89. 'default_font_colour' => [ 
  90. 'id' => 'default_font_colour',  
  91. 'name' => esc_html__( 'Default Font Color', 'gravity-forms-pdf-extended' ),  
  92. 'type' => 'color',  
  93. 'std' => '#000000',  
  94. 'desc' => esc_html__( 'Set the default font color used in PDFs.', 'gravity-forms-pdf-extended' ),  
  95. ],  
  96.  
  97. 'default_rtl' => [ 
  98. 'id' => 'default_rtl',  
  99. 'name' => esc_html__( 'Reverse Text (RTL)', 'gravity-forms-pdf-extended' ),  
  100. 'desc' => esc_html__( 'Script like Arabic and Hebrew are written right to left.', 'gravity-forms-pdf-extended' ),  
  101. 'type' => 'radio',  
  102. 'options' => [ 
  103. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  104. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  105. ],  
  106. 'std' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  107. 'tooltip' => '<h6>' . esc_html__( 'Reverse Text (RTL)', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( "Enable RTL if you are writing in Arabic, Hebrew, Syriac, N'ko, Thaana, Tifinar, Urdu or other RTL languages.", 'gravity-forms-pdf-extended' ),  
  108. ],  
  109.  
  110. 'default_action' => [ 
  111. 'id' => 'default_action',  
  112. 'name' => esc_html__( 'Entry View', 'gravity-forms-pdf-extended' ),  
  113. 'desc' => sprintf( esc_html__( 'Select the default action used when accessing a PDF from the %sGravity Forms entries list%s page.', 'gravity-forms-pdf-extended' ), '<a href="' . admin_url( 'admin.php?page=gf_entries' ) . '">', '</a>' ),  
  114. 'type' => 'radio',  
  115. 'options' => [ 
  116. 'View' => esc_html__( 'View', 'gravity-forms-pdf-extended' ),  
  117. 'Download' => esc_html__( 'Download', 'gravity-forms-pdf-extended' ),  
  118. ],  
  119. 'std' => 'View',  
  120. 'tooltip' => '<h6>' . esc_html__( 'Entry View', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'Choose to view the PDF in your web browser or download the document to your computer.', 'gravity-forms-pdf-extended' ),  
  121. ],  
  122.  
  123. 'update_screen_action' => [ 
  124. 'id' => 'update_screen_action',  
  125. 'name' => esc_html__( "Show What's New", 'gravity-forms-pdf-extended' ),  
  126. 'desc' => "When updating to a new release we'll redirect you to our What's New page.",  
  127. 'type' => 'radio',  
  128. 'options' => [ 
  129. 'Enable' => esc_html__( 'Enable', 'gravity-forms-pdf-extended' ),  
  130. 'Disable' => esc_html__( 'Disable', 'gravity-forms-pdf-extended' ),  
  131. ],  
  132. 'std' => 'Enable',  
  133. 'tooltip' => '<h6>' . esc_html__( "Show What's New Page", 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( "When upgrading Gravity PDF to a new major release (4.x) we'll automatically redirect you to our What's New page so you can see the changes. Bug fix and security releases are excluded (4.x.x).", 'gravity-forms-pdf-extended' ),  
  134. ],  
  135. ),  
  136.  
  137. /** See https://gravitypdf.com/documentation/v4/gfpdf_settings_general_security/ for more details about this filter */ 
  138. 'general_security' => apply_filters( 'gfpdf_settings_general_security',  
  139. 'admin_capabilities' => [ 
  140. 'id' => 'admin_capabilities',  
  141. 'name' => esc_html__( 'User Restriction', 'gravity-forms-pdf-extended' ),  
  142. 'desc' => esc_html__( 'Restrict PDF access to users with any of these capabilities. The Administrator Role always has full access.', 'gravity-forms-pdf-extended' ),  
  143. 'type' => 'select',  
  144. 'options' => $this->get_capabilities(),  
  145. 'std' => 'gravityforms_view_entries',  
  146. 'inputClass' => 'large',  
  147. 'chosen' => true,  
  148. 'multiple' => true,  
  149. 'required' => true,  
  150. 'placeholder' => esc_html__( 'Select Capability', 'gravity-forms-pdf-extended' ),  
  151. 'tooltip' => '<h6>' . esc_html__( 'User Restriction', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( "Only logged in users with any selected capability can view generated PDFs they don't have ownership of. Ownership refers to an end user who completed the original Gravity Form entry.", 'gravity-forms-pdf-extended' ),  
  152. ],  
  153.  
  154. 'default_restrict_owner' => [ 
  155. 'id' => 'default_restrict_owner',  
  156. 'name' => esc_html__( 'Default Owner Restrictions', 'gravity-forms-pdf-extended' ),  
  157. 'desc' => esc_html__( 'Set the default PDF owner permissions. When enabled, the original entry owner will NOT be able to view the PDFs (unless they have one of the above capabilities).', 'gravity-forms-pdf-extended' ),  
  158. 'type' => 'radio',  
  159. 'options' => [ 
  160. 'Yes' => esc_html__( 'Enable', 'gravity-forms-pdf-extended' ),  
  161. 'No' => esc_html__( 'Disable', 'gravity-forms-pdf-extended' ),  
  162. ],  
  163. 'std' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  164. 'tooltip' => '<h6>' . esc_html__( 'Restrict Owner', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'Enable this setting if your PDFs should not be viewable by the end user. This can be set on a per-PDF basis.', 'gravity-forms-pdf-extended' ),  
  165. ],  
  166.  
  167. 'logged_out_timeout' => [ 
  168. 'id' => 'logged_out_timeout',  
  169. 'name' => esc_html__( 'Logged Out Timeout', 'gravity-forms-pdf-extended' ),  
  170. 'desc' => sprintf( esc_html__( 'Limit how long a %slogged out%s users has direct access to the PDF after completing the form. Set to 0 to disable time limit (not recommended).', 'gravity-forms-pdf-extended' ), '<em>', '</em>' ),  
  171. 'desc2' => esc_html__( 'minutes', 'gravity-forms-pdf-extended' ),  
  172. 'type' => 'number',  
  173. 'size' => 'small',  
  174. 'std' => 20,  
  175. 'tooltip' => '<h6>' . esc_html__( 'Logged Out Timeout', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'Logged out users can view PDFs when their IP matches the one assigned to the Gravity Form entry. Because IP addresses can change, a time-based restriction also applies.', 'gravity-forms-pdf-extended' ),  
  176. ],  
  177. ),  
  178.  
  179. /** Extension Settings */ 
  180. 'extensions' => apply_filters( 'gfpdf_settings_extensions',  
  181. [] 
  182. ),  
  183.  
  184. /** License Settings */ 
  185. 'licenses' => apply_filters( 'gfpdf_settings_licenses',  
  186. [] 
  187. ),  
  188.  
  189. /** 
  190. * Tools Settings 
  191. * See https://gravitypdf.com/documentation/v4/gfpdf_settings_tools/ for more details about this filter 
  192. */ 
  193. 'tools' => apply_filters( 'gfpdf_settings_tools',  
  194. 'setup_templates' => [ 
  195. 'id' => 'setup_templates',  
  196. 'name' => esc_html__( 'Setup Custom Templates', 'gravity-forms-pdf-extended' ),  
  197. 'desc' => sprintf( esc_html__( 'Setup environment for building custom templates. %sSee docs to get started%s.', 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/documentation/v4/developer-first-custom-pdf/">', '</a>' ),  
  198. 'type' => 'button',  
  199. 'std' => esc_html__( 'Run Setup', 'gravity-forms-pdf-extended' ),  
  200. 'options' => 'copy',  
  201. 'tooltip' => '<h6>' . esc_html__( 'Setup Custom Templates', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'The setup will copy the plugin templates to your uploads directory so you can freely create and modify PDF templates without the risk of overriding your modifications when the plugin updates.', 'gravity-forms-pdf-extended' ),  
  202. ],  
  203.  
  204. 'manage_fonts' => [ 
  205. 'id' => 'manage_fonts',  
  206. 'name' => esc_html__( 'Fonts', 'gravity-forms-pdf-extended' ),  
  207. 'desc' => esc_html__( 'Add, update or remove custom fonts.', 'gravity-forms-pdf-extended' ),  
  208. 'type' => 'button',  
  209. 'std' => esc_html__( 'Manage Fonts', 'gravity-forms-pdf-extended' ),  
  210. 'options' => 'install_fonts',  
  211. 'tooltip' => '<h6>' . esc_html__( 'Install Fonts', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'Custom fonts can be installed for use in your PDFs. Only %s.ttf%s font files are supported.', 'gravity-forms-pdf-extended' ), '<code>', '</code>', '<code>', '</code>', '<code>', '</code>' ),  
  212. ],  
  213. ),  
  214.  
  215. /** 
  216. * Form (PDF) Settings 
  217. * See https://gravitypdf.com/documentation/v4/gfpdf_form_settings/ for more details about this filter 
  218. */ 
  219. 'form_settings' => apply_filters( 'gfpdf_form_settings',  
  220. 'name' => [ 
  221. 'id' => 'name',  
  222. 'name' => esc_html__( 'Name', 'gravity-forms-pdf-extended' ),  
  223. 'type' => 'text',  
  224. 'required' => true,  
  225. 'tooltip' => '<h6>' . esc_html__( 'PDF Name', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'Distinguish between multiple PDFs by giving it an easy-to-remember name (for internal use). Use the %sFilename%s field below to set the actual PDF name.', 'gravity-forms-pdf-extended' ), '<em>', '</em>' ),  
  226. ],  
  227.  
  228. 'template' => [ 
  229. 'id' => 'template',  
  230. 'name' => esc_html__( 'Template', 'gravity-forms-pdf-extended' ),  
  231. 'desc' => sprintf( esc_html__( 'Choose an existing template or purchased more %sfrom our theme shop%s. You can also %sbuild your own%s or %shire us%s to create a custom solution.', 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/shop/">', '</a>', '<a href="https://gravitypdf.com/documentation/v4/developer-start-customising/">', '</a>', '<a href="https://gravitypdf.com/integration-services/">', '</a>' ),  
  232. 'type' => 'select',  
  233. 'options' => $this->templates->get_all_templates_by_group(),  
  234. 'std' => $this->get_option( 'default_template', 'zadani' ),  
  235. 'inputClass' => 'large',  
  236. 'chosen' => true,  
  237. 'tooltip' => '<h6>' . esc_html__( 'Templates', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'Gravity PDF comes with %sfour completely-free and highly customizable designs%s. You can also purchase additional templates from our theme shop, hire us to integrate existing PDFs or, with a bit of technical know-how, build your own.', 'gravity-forms-pdf-extended' ), '<strong>', '</strong>' ),  
  238. ],  
  239.  
  240. 'notification' => [ 
  241. 'id' => 'notification',  
  242. 'name' => esc_html__( 'Notifications', 'gravity-forms-pdf-extended' ),  
  243. 'desc' => esc_html__( 'Automatically attach PDF to the selected notifications.', 'gravity-forms-pdf-extended' ),  
  244. 'type' => 'select',  
  245. 'options' => [],  
  246. 'inputClass' => 'large',  
  247. 'chosen' => true,  
  248. 'multiple' => true,  
  249. 'placeholder' => esc_html__( 'Choose a Notification', 'gravity-forms-pdf-extended' ),  
  250. 'tooltip' => '<h6>' . esc_html__( 'Notifications', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'Automatically generate and attach the PDF to your selected notifications. Conditional Logic for both the PDF and the notification applies. Inactive PDFs are also not sent.', 'gravity-forms-pdf-extended' ),  
  251. ],  
  252.  
  253. 'filename' => [ 
  254. 'id' => 'filename',  
  255. 'name' => esc_html__( 'Filename', 'gravity-forms-pdf-extended' ),  
  256. 'type' => 'text',  
  257. 'desc' => 'The name used when saving a PDF. Mergetags are allowed.',  
  258. 'tooltip' => '<h6>' . esc_html__( 'Filename', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'Set an appropriate filename for the generated PDF. You should exclude the .pdf extension from the name. The following are invalid characters and will be converted to an underscore %s_%s when the PDF is generated: %s', 'gravity-forms-pdf-extended' ), '<code>', '</code>', '<code>/ \ " * ? | : < ></code>' ),  
  259. 'inputClass' => 'merge-tag-support mt-hide_all_fields',  
  260. 'required' => true,  
  261. ],  
  262.  
  263. 'conditional' => [ 
  264. 'id' => 'conditional',  
  265. 'name' => esc_html__( 'Conditional Logic', 'gravity-forms-pdf-extended' ),  
  266. 'type' => 'conditional_logic',  
  267. 'desc' => esc_html__( 'Enable conditional logic', 'gravity-forms-pdf-extended' ),  
  268. 'class' => 'conditional_logic',  
  269. 'inputClass' => 'conditional_logic_listener',  
  270. 'tooltip' => '<h6>' . esc_html__( 'Conditional Logic', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'Create rules to dynamically enable or disable PDFs. This includes attaching to notifications and viewing from your admin area.', 'gravity-forms-pdf-extended' ),  
  271. ],  
  272.  
  273. 'conditionalLogic' => [ 
  274. 'id' => 'conditionalLogic',  
  275. 'type' => 'hidden',  
  276. 'class' => 'gfpdf-hidden',  
  277. ],  
  278.  
  279. ),  
  280.  
  281. /** 
  282. * Form (PDF) Settings Appearance 
  283. * See https://gravitypdf.com/documentation/v4/gfpdf_form_settings_appearance/ for more details about this filter 
  284. */ 
  285. 'form_settings_appearance' => apply_filters( 'gfpdf_form_settings_appearance',  
  286. 'pdf_size' => [ 
  287. 'id' => 'pdf_size',  
  288. 'name' => esc_html__( 'Paper Size', 'gravity-forms-pdf-extended' ),  
  289. 'desc' => esc_html__( 'Set the paper size used when generating PDFs.', 'gravity-forms-pdf-extended' ),  
  290. 'type' => 'select',  
  291. 'options' => $this->get_paper_size(),  
  292. 'std' => $this->get_option( 'default_pdf_size', 'A4' ),  
  293. 'inputClass' => 'large',  
  294. 'class' => 'gfpdf_paper_size',  
  295. 'chosen' => true,  
  296. ],  
  297.  
  298. 'custom_pdf_size' => [ 
  299. 'id' => 'custom_pdf_size',  
  300. 'name' => esc_html__( 'Custom Paper Size', 'gravity-forms-pdf-extended' ),  
  301. 'desc' => esc_html__( 'Control the exact paper size. Can be set in millimeters or inches.', 'gravity-forms-pdf-extended' ),  
  302. 'type' => 'paper_size',  
  303. 'size' => 'small',  
  304. 'chosen' => true,  
  305. 'required' => true,  
  306. 'class' => 'gfpdf-hidden gfpdf_paper_size_other',  
  307. 'std' => $this->get_option( 'default_custom_pdf_size' ),  
  308. ],  
  309.  
  310. 'orientation' => [ 
  311. 'id' => 'orientation',  
  312. 'name' => esc_html__( 'Orientation', 'gravity-forms-pdf-extended' ),  
  313. 'type' => 'select',  
  314. 'options' => [ 
  315. 'portrait' => esc_html__( 'Portrait', 'gravity-forms-pdf-extended' ),  
  316. 'landscape' => esc_html__( 'Landscape', 'gravity-forms-pdf-extended' ),  
  317. ],  
  318. 'inputClass' => 'large',  
  319. 'chosen' => true,  
  320. ],  
  321.  
  322. 'font' => [ 
  323. 'id' => 'font',  
  324. 'name' => esc_html__( 'Font', 'gravity-forms-pdf-extended' ),  
  325. 'type' => 'select',  
  326. 'options' => $this->get_installed_fonts(),  
  327. 'std' => $this->get_option( 'default_font' ),  
  328. 'desc' => sprintf( esc_html__( 'Set the font type used in PDFs. Choose an existing font or %sinstall your own%s.', 'gravity-forms-pdf-extended' ), '<a href="' . $this->data->settings_url . '&tab=tools#manage_fonts">', '</a>' ),  
  329. 'inputClass' => 'large',  
  330. 'chosen' => true,  
  331. 'tooltip' => '<h6>' . esc_html__( 'Fonts', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'Gravity PDF comes bundled with fonts for most languages world-wide. Want to use a specific font type? Use the font installer (found in the Forms -> Settings -> Tools tab).', 'gravity-forms-pdf-extended' ),  
  332. 'class' => 'gfpdf_font_type',  
  333. ],  
  334.  
  335. 'font_size' => [ 
  336. 'id' => 'font_size',  
  337. 'name' => esc_html__( 'Font Size', 'gravity-forms-pdf-extended' ),  
  338. 'desc' => esc_html__( 'Set the font size to use in the PDF.', 'gravity-forms-pdf-extended' ),  
  339. 'desc2' => 'pt',  
  340. 'type' => 'number',  
  341. 'size' => 'small',  
  342. 'std' => $this->get_option( 'default_font_size', 10 ),  
  343. 'class' => 'gfpdf_font_size',  
  344. ],  
  345.  
  346. 'font_colour' => [ 
  347. 'id' => 'font_colour',  
  348. 'name' => esc_html__( 'Font Color', 'gravity-forms-pdf-extended' ),  
  349. 'type' => 'color',  
  350. 'std' => $this->get_option( 'default_font_colour', '#000000' ),  
  351. 'desc' => esc_html__( 'Set the font color to use in the PDF.', 'gravity-forms-pdf-extended' ),  
  352. 'class' => 'gfpdf_font_colour',  
  353. ],  
  354.  
  355. 'rtl' => [ 
  356. 'id' => 'rtl',  
  357. 'name' => esc_html__( 'Reverse Text (RTL)', 'gravity-forms-pdf-extended' ),  
  358. 'desc' => esc_html__( 'Script like Arabic and Hebrew are written right to left.', 'gravity-forms-pdf-extended' ),  
  359. 'type' => 'radio',  
  360. 'options' => [ 
  361. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  362. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  363. ],  
  364. 'std' => $this->get_option( 'default_rtl', 'No' ),  
  365. 'tooltip' => '<h6>' . esc_html__( 'Reverse Text (RTL)', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( "Enable RTL if you are writing in Arabic, Hebrew, Syriac, N'ko, Thaana, Tifinar or Urdu.", 'gravity-forms-pdf-extended' ),  
  366. ],  
  367.  
  368. ),  
  369.  
  370. /** 
  371. * Form (PDF) Settings Custom Appearance 
  372. * This filter allows templates to add custom options for use specific to that template 
  373. * Gravity PDF autoloads a PHP template file if it exists and loads it up with this filter 
  374. * See https://gravitypdf.com/documentation/v4/developer-template-configuration-and-image/#template-configuration for more details 
  375. */ 
  376. 'form_settings_custom_appearance' => apply_filters( 'gfpdf_form_settings_custom_appearance',  
  377. [] 
  378. ),  
  379.  
  380. /** 
  381. * Form (PDF) Settings Advanced 
  382. * See https://gravitypdf.com/documentation/v4/gfpdf_form_settings_advanced/ for more details about this filter 
  383. */ 
  384. 'form_settings_advanced' => apply_filters( 'gfpdf_form_settings_advanced',  
  385. 'format' => [ 
  386. 'id' => 'format',  
  387. 'name' => esc_html__( 'Format', 'gravity-forms-pdf-extended' ),  
  388. 'desc' => esc_html__( 'Generate a PDF in the selected format.', 'gravity-forms-pdf-extended' ),  
  389. 'type' => 'radio',  
  390. 'options' => [ 
  391. 'Standard' => 'Standard',  
  392. 'PDFA1B' => 'PDF/A-1b',  
  393. 'PDFX1A' => 'PDF/X-1a',  
  394. ],  
  395. 'std' => 'Standard',  
  396. 'tooltip' => '<h6>' . esc_html__( 'PDF Format', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( "Generate a document adhearing to the appropriate PDF standard. When not in %sStandard%s mode, watermarks, alpha-transparent PNGs and security options can NOT be used.", 'gravity-forms-pdf-extended' ), '<em>', '</em>' ),  
  397. ],  
  398.  
  399. 'security' => [ 
  400. 'id' => 'security',  
  401. 'name' => esc_html__( 'Enable PDF Security', 'gravity-forms-pdf-extended' ),  
  402. 'desc' => esc_html__( 'Password protect generated PDFs, or restrict user capabilities.', 'gravity-forms-pdf-extended' ),  
  403. 'type' => 'radio',  
  404. 'options' => [ 
  405. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  406. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  407. ],  
  408. 'std' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  409. ],  
  410.  
  411. 'password' => [ 
  412. 'id' => 'password',  
  413. 'name' => esc_html__( 'Password', 'gravity-forms-pdf-extended' ),  
  414. 'type' => 'text',  
  415. 'desc' => 'Password protect the PDF, or leave blank to disable password protection.',  
  416. 'inputClass' => 'merge-tag-support mt-hide_all_fields',  
  417. ],  
  418.  
  419. 'privileges' => [ 
  420. 'id' => 'privileges',  
  421. 'name' => esc_html__( 'Privileges', 'gravity-forms-pdf-extended' ),  
  422. 'desc' => 'Restrict end user capabilities by removing privileges.',  
  423. 'type' => 'select',  
  424. 'options' => $this->get_privilages(),  
  425. 'std' => [ 
  426. 'copy',  
  427. 'print',  
  428. 'print-highres',  
  429. 'modify',  
  430. 'annot-forms',  
  431. 'fill-forms',  
  432. 'extract',  
  433. 'assemble',  
  434. ],  
  435. 'inputClass' => 'large',  
  436. 'chosen' => true,  
  437. 'tooltip' => '<h6>' . esc_html__( 'Privileges', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'You can prevent the end user completing certain actions to the PDF * such as copying text, printing, adding annotations or extracting pages.', 'gravity-forms-pdf-extended' ),  
  438. 'multiple' => true,  
  439. 'placeholder' => esc_html__( 'Select End User PDF Privileges', 'gravity-forms-pdf-extended' ),  
  440. ],  
  441.  
  442. 'image_dpi' => [ 
  443. 'id' => 'image_dpi',  
  444. 'name' => esc_html__( 'Image DPI', 'gravity-forms-pdf-extended' ),  
  445. 'type' => 'number',  
  446. 'size' => 'small',  
  447. 'std' => 96,  
  448. 'tooltip' => '<h6>' . esc_html__( 'Image DPI', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'Control the image DPI (dots per inch) in PDFs. Set to 300 when professionally printing document.', 'gravity-forms-pdf-extended' ),  
  449. ],  
  450.  
  451. 'save' => [ 
  452. 'id' => 'save',  
  453. 'name' => esc_html__( 'Always Save PDF', 'gravity-forms-pdf-extended' ),  
  454. 'desc' => esc_html__( 'Force a PDF to be saved to disk when a new entry is created.', 'gravity-forms-pdf-extended' ),  
  455. 'type' => 'radio',  
  456. 'options' => [ 
  457. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  458. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  459. ],  
  460. 'std' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  461. 'tooltip' => '<h6>' . esc_html__( 'Save PDF', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( "By default, PDFs are not automatically saved to disk. Enable this option to force the PDF to be generated and saved. Useful when using the %sgfpdf_post_pdf_save%s hook to copy the PDF to an alternate location.", 'gravity-forms-pdf-extended' ), '<code>', '</code>' ),  
  462. ],  
  463.  
  464. 'public_access' => [ 
  465. 'id' => 'public_access',  
  466. 'name' => esc_html__( 'Enable Public Access', 'gravity-forms-pdf-extended' ),  
  467. 'desc' => sprintf( esc_html__( 'Allow %sanyone%s with a direct link to access the PDF. %sThis disables all %ssecurity protocols%s for this PDF.%s ', 'gravity-forms-pdf-extended' ), '<strong>', '</strong>', '<em>', '<a href="https://gravitypdf.com/documentation/v4/user-pdf-security/">', '</a>', '</em>' ),  
  468. 'type' => 'radio',  
  469. 'options' => [ 
  470. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  471. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  472. ],  
  473. 'std' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  474. 'tooltip' => '<h6>' . esc_html__( 'Public Access', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( "When public access is on all security protocols are disabled and anyone worldwide can view the PDF document for ALL your form's entries. For most users the standard security measures will be adequate and public access should remain disabled.", 'gravity-forms-pdf-extended' ),  
  475. ],  
  476.  
  477. 'restrict_owner' => [ 
  478. 'id' => 'restrict_owner',  
  479. 'name' => esc_html__( 'Restrict Owner', 'gravity-forms-pdf-extended' ),  
  480. 'desc' => esc_html__( 'When enabled, the original entry owner will NOT be able to view the PDFs.', 'gravity-forms-pdf-extended' ),  
  481. 'type' => 'radio',  
  482. 'options' => [ 
  483. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  484. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  485. ],  
  486. 'std' => $this->get_option( 'default_restrict_owner', 'No' ),  
  487. 'tooltip' => '<h6>' . esc_html__( 'Restrict Owner', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'Enable this setting if your PDFs should not be viewable by the end user.', 'gravity-forms-pdf-extended' ),  
  488. ],  
  489. ),  
  490. ]; 
  491.  
  492. /** See https://gravitypdf.com/documentation/v4/gfpdf_registered_fields/ for more details about this filter */ 
  493.  
  494. return apply_filters( 'gfpdf_registered_fields', $gfpdf_settings ); 
  495.  
  496. /** 
  497. * Enable advanced templating field if the user has our legacy premium plugin installed 
  498. * Dev notice: We're going to rewrite and rename the Tier 2 premium add-on and utilise template headers to automatically handle 
  499. * advanced templates without the need for user intervention, which is why this method doesn't have a filter to manually 
  500. * enable it. 
  501. * @param array $settings The 'form_settings_advanced' array 
  502. * @return array 
  503. * @since 4.0 
  504. */ 
  505. public function get_advanced_template_field( $settings ) { 
  506.  
  507. if ( ! class_exists( 'gfpdfe_business_plus' ) ) { 
  508. return $settings; 
  509.  
  510. $settings['advanced_template'] = [ 
  511. 'id' => 'advanced_template',  
  512. 'name' => esc_html__( 'Enable Advanced Templating', 'gravity-forms-pdf-extended' ),  
  513. 'desc' => esc_html__( 'By enabling, a PDF template will no longer be treated as HTML.', 'gravity-forms-pdf-extended' ),  
  514. 'type' => 'radio',  
  515. 'options' => [ 
  516. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  517. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  518. ],  
  519. 'std' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  520. ]; 
  521.  
  522. return $settings; 
  523.  
  524. /** 
  525. * Return the optional template-specific form title field 
  526. * @return array 
  527. * @since 4.0 
  528. */ 
  529. public function get_form_title_display_field() { 
  530. return apply_filters( 'gfpdf_form_title_display_setting', [ 
  531. 'id' => 'show_form_title',  
  532. 'name' => esc_html__( 'Show Form Title', 'gravity-forms-pdf-extended' ),  
  533. 'desc' => esc_html__( 'Display the form title at the beginning of the PDF.', 'gravity-forms-pdf-extended' ),  
  534. 'type' => 'radio',  
  535. 'options' => [ 
  536. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  537. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  538. ],  
  539. 'std' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  540. ] ); 
  541.  
  542. /** 
  543. * Return the optional template-specific page names field 
  544. * @return array 
  545. * @since 4.0 
  546. */ 
  547. public function get_page_names_display_field() { 
  548. return apply_filters( 'gfpdf_page_names_display_setting', [ 
  549. 'id' => 'show_page_names',  
  550. 'name' => esc_html__( 'Show Page Names', 'gravity-forms-pdf-extended' ),  
  551. 'desc' => sprintf( esc_html__( 'Display form page names on the PDF. Requires the use of the %sPage Break field%s.', 'gravity-forms-pdf-extended' ), '<a href="https://www.gravityhelp.com/documentation/article/page-break/">', '</a>' ),  
  552. 'type' => 'radio',  
  553. 'options' => [ 
  554. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  555. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  556. ],  
  557. 'std' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  558. ] ); 
  559.  
  560. /** 
  561. * Return the optional template-specific HTML field 
  562. * @return array 
  563. * @since 4.0 
  564. */ 
  565. public function get_html_display_field() { 
  566. return apply_filters( 'gfpdf_html_display_setting', [ 
  567. 'id' => 'show_html',  
  568. 'name' => esc_html__( 'Show HTML Fields', 'gravity-forms-pdf-extended' ),  
  569. 'desc' => esc_html__( 'Display HTML fields in the PDF.', 'gravity-forms-pdf-extended' ),  
  570. 'type' => 'radio',  
  571. 'options' => [ 
  572. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  573. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  574. ],  
  575. 'std' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  576. ] ); 
  577.  
  578. /** 
  579. * Return the optional template-specific section content field 
  580. * @return array 
  581. * @since 4.0 
  582. */ 
  583. public function get_section_content_display_field() { 
  584. return apply_filters( 'gfpdf_section_content_display_setting', [ 
  585. 'id' => 'show_section_content',  
  586. 'name' => esc_html__( 'Show Section Break Description', 'gravity-forms-pdf-extended' ),  
  587. 'desc' => esc_html__( 'Display the Section Break field description in the PDF.', 'gravity-forms-pdf-extended' ),  
  588. 'type' => 'radio',  
  589. 'options' => [ 
  590. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  591. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  592. ],  
  593. 'std' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  594. ] ); 
  595.  
  596. /** 
  597. * Return the optional template-specific hidden field 
  598. * @return array 
  599. * @since 4.0 
  600. */ 
  601. public function get_conditional_display_field() { 
  602. return apply_filters( 'gfpdf_conditional_display_setting', [ 
  603. 'id' => 'enable_conditional',  
  604. 'name' => esc_html__( 'Enable Conditional Logic', 'gravity-forms-pdf-extended' ),  
  605. 'desc' => esc_html__( 'When enabled the PDF will adhere to the form field conditional logic.', 'gravity-forms-pdf-extended' ),  
  606. 'type' => 'radio',  
  607. 'options' => [ 
  608. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  609. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  610. ],  
  611. 'std' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  612. 'tooltip' => '<h6>' . esc_html__( 'Enable Conditional Logic', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'Enable this option to hide failed conditional logic fields in the PDF.', 'gravity-forms-pdf-extended' ),  
  613. ] ); 
  614.  
  615. /** 
  616. * Return the optional template-specific empty field 
  617. * @return array 
  618. * @since 4.0 
  619. */ 
  620. public function get_empty_display_field() { 
  621. return apply_filters( 'gfpdf_empty_display_setting', [ 
  622. 'id' => 'show_empty',  
  623. 'name' => esc_html__( 'Show Empty Fields', 'gravity-forms-pdf-extended' ),  
  624. 'desc' => esc_html__( 'Display Empty fields in the PDF.', 'gravity-forms-pdf-extended' ),  
  625. 'type' => 'radio',  
  626. 'options' => [ 
  627. 'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),  
  628. 'No' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  629. ],  
  630. 'std' => esc_html__( 'No', 'gravity-forms-pdf-extended' ),  
  631. ] ); 
  632.  
  633. /** 
  634. * Return the optional template-specific header field 
  635. * @return array 
  636. * @since 4.0 
  637. */ 
  638. public function get_header_field() { 
  639. return apply_filters( 'gfpdf_header_field_setting', [ 
  640. 'id' => 'header',  
  641. 'name' => esc_html__( 'Header', 'gravity-forms-pdf-extended' ),  
  642. 'type' => 'rich_editor',  
  643. 'size' => 8,  
  644. 'desc' => sprintf( esc_html__( 'The header is included at the top of each page. For simple columns %stry this HTML table snippet%s.', 'gravity-forms-pdf-extended' ), '<a href="https://gist.github.com/jakejackson1/997b5dedf0a5e665e8ef">', '</a>' ),  
  645. 'inputClass' => 'merge-tag-support mt-wp_editor mt-manual_position mt-position-right mt-hide_all_fields',  
  646. 'tooltip' => '<h6>' . esc_html__( 'Header', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'When inserting images in the header set the size to %sLarge%s or %sFull Size%s.', 'gravity-forms-pdf-extended' ), '<em>', '</em>', '<em>', '</em>' ),  
  647. ] ); 
  648.  
  649. /** 
  650. * Return the optional template-specific first page header field 
  651. * @return array 
  652. * @since 4.0 
  653. */ 
  654. public function get_first_page_header_field() { 
  655. return apply_filters( 'gfpdf_first_page_header_field_setting', [ 
  656. 'id' => 'first_header',  
  657. 'name' => esc_html__( 'First Page Header', 'gravity-forms-pdf-extended' ),  
  658. 'type' => 'rich_editor',  
  659. 'size' => 8,  
  660. 'desc' => esc_html__( 'Override the header on the first page of the PDF.', 'gravity-forms-pdf-extended' ),  
  661. 'inputClass' => 'merge-tag-support mt-wp_editor mt-manual_position mt-position-right mt-hide_all_fields',  
  662. 'toggle' => esc_html__( 'Use different header on first page of PDF?', 'gravity-forms-pdf-extended' ),  
  663. ] ); 
  664.  
  665. /** 
  666. * Return the optional template-specific footer field 
  667. * @return array 
  668. * @since 4.0 
  669. */ 
  670. public function get_footer_field() { 
  671. return apply_filters( 'gfpdf_footer_field_setting', [ 
  672. 'id' => 'footer',  
  673. 'name' => esc_html__( 'Footer', 'gravity-forms-pdf-extended' ),  
  674. 'type' => 'rich_editor',  
  675. 'size' => 8,  
  676. 'desc' => sprintf( esc_html__( 'The footer is included at the bottom of every page. For simple columns %stry this HTML table snippet%s.', 'gravity-forms-pdf-extended' ), '<a href="https://gist.github.com/jakejackson1/e6179a96cd97ef0a8457">', '</a>' ),  
  677. 'inputClass' => 'merge-tag-support mt-wp_editor mt-manual_position mt-position-right mt-hide_all_fields',  
  678. 'tooltip' => '<h6>' . esc_html__( 'Footer', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'For simple text footers use the left, center and right alignment buttons in the editor. You can also use the special %s{PAGENO}%s and %s{nbpg}%s tags to display page numbering.', 'gravity-forms-pdf-extended' ), '<em>', '</em>', '<em>', '</em>' ),  
  679. ] ); 
  680.  
  681. /** 
  682. * Return the optional template-specific first page footer field 
  683. * @return array 
  684. * @since 4.0 
  685. */ 
  686. public function get_first_page_footer_field() { 
  687. return apply_filters( 'gfpdf_first_page_footer_field_setting', [ 
  688. 'id' => 'first_footer',  
  689. 'name' => esc_html__( 'First Page Footer', 'gravity-forms-pdf-extended' ),  
  690. 'type' => 'rich_editor',  
  691. 'size' => 8,  
  692. 'desc' => esc_html__( 'Override the footer on the first page of the PDF.', 'gravity-forms-pdf-extended' ),  
  693. 'inputClass' => 'merge-tag-support mt-wp_editor mt-manual_position mt-position-right mt-hide_all_fields',  
  694. 'toggle' => esc_html__( 'Use different footer on first page of PDF?', 'gravity-forms-pdf-extended' ),  
  695. ] ); 
  696.  
  697. /** 
  698. * Return the optional template-specific background color field 
  699. * @return array 
  700. * @since 4.0 
  701. */ 
  702. public function get_background_color_field() { 
  703. return apply_filters( 'gfpdf_background_color_field_setting', [ 
  704. 'id' => 'background_color',  
  705. 'name' => esc_html__( 'Background Color', 'gravity-forms-pdf-extended' ),  
  706. 'type' => 'color',  
  707. 'std' => '#FFF',  
  708. 'desc' => esc_html__( 'Set the background color for all pages.', 'gravity-forms-pdf-extended' ),  
  709. ] ); 
  710.  
  711. /** 
  712. * Return the optional template-specific background image field 
  713. * @return array 
  714. * @since 4.0 
  715. */ 
  716. public function get_background_image_field() { 
  717. return apply_filters( 'gfpdf_background_image_field_setting', [ 
  718. 'id' => 'background_image',  
  719. 'name' => esc_html__( 'Background Image', 'gravity-forms-pdf-extended' ),  
  720. 'type' => 'upload',  
  721. 'desc' => esc_html__( 'The background image is included on all pages. For optimal results, use an image the same dimensions as the paper size.', 'gravity-forms-pdf-extended' ),  
  722. 'tooltip' => '<h6>' . esc_html__( 'Background Image', 'gravity-forms-pdf-extended' ) . '</h6>' . esc_html__( 'For the best results, use a JPG or non-interlaced 8-Bit PNG that has the same dimensions as the paper size.', 'gravity-forms-pdf-extended' ),  
  723. ] );