@@ -70,82 +70,83 @@ public function __construct( $plugin_file ) {
70
70
71
71
}
72
72
73
- public function html ( $ quoteTemplate , $ metabox ) {
74
-
75
- global $ zbs ;
76
-
77
- // localise ID
78
- $ quoteTemplateID = -1 ; if (is_array ($ quoteTemplate ) && isset ($ quoteTemplate ['id ' ])) $ quoteTemplateID = (int )$ quoteTemplate ['id ' ];
79
- $ quoteTemplateContent = '' ; if (is_array ($ quoteTemplate ) && isset ($ quoteTemplate ['content ' ])) $ quoteTemplateContent = $ quoteTemplate ['content ' ];
80
-
81
- ?>
82
- <script type="text/javascript">var zbscrmjs_secToken = '<?php echo esc_js ( wp_create_nonce ( 'zbscrmjs-ajax-nonce ' ) ); ?> ';</script>
83
- <?php
84
-
85
- // pass specific placeholder list for WYSIWYG inserter
86
- // <TBC> is there a better place to pass this?
87
- $ placeholder_templating = $ zbs ->get_templating ();
88
- $ placeholder_list = $ placeholder_templating ->get_placeholders_for_tooling ( array ( 'quote ' , 'contact ' , 'global ' ), false , false );
89
- echo '<script>var jpcrm_placeholder_list = ' . json_encode ( $ placeholder_templating ->simplify_placeholders_for_wysiwyg ( $ placeholder_list ) ) . ';</script> ' ;
90
-
91
- // for mvp v3.0 we now just hard-type these, as there a lesser obj rarely used.
92
- $ fields = array (
93
-
94
- 'title ' => array (
95
-
96
- 0 => 'text ' ,
97
- 1 => __ ('Template Title ' ,'zero-bs-crm ' ),
98
- 2 => '' , // placeholder
99
- 'essential ' => 1
100
-
101
- ),
102
-
103
- 'value ' => array (
104
-
105
- 0 => 'price ' ,
106
- 1 => __ ('Starting Value ' ,'zero-bs-crm ' ),
107
- 2 => '' , // placeholder
108
- 'essential ' => 1
109
-
110
- ),
111
-
112
- 'notes ' => array (
113
-
114
- 0 => 'textarea ' ,
115
- 1 => __ ('Notes ' ,'zero-bs-crm ' ),
116
- 2 => '' , // placeholder
117
- 'essential ' => 1
118
-
119
- )
120
- );
121
-
73
+ /**
74
+ * Outputs the HTML for the Quote Template metabox.
75
+ *
76
+ * @param array $quote_template The quote template data.
77
+ * @param array $metabox Unused.
78
+ */
79
+ public function html ( $ quote_template , $ metabox ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
80
+
81
+ global $ zbs ;
82
+
83
+ $ quote_template_content = '' ;
84
+ if ( is_array ( $ quote_template ) && isset ( $ quote_template ['content ' ] ) ) {
85
+ $ quote_template_content = $ quote_template ['content ' ];
86
+ }
87
+ ?>
88
+ <script type="text/javascript">var zbscrmjs_secToken = '<?php echo esc_js ( wp_create_nonce ( 'zbscrmjs-ajax-nonce ' ) ); ?> ';</script>
89
+ <?php
90
+
91
+ // pass specific placeholder list for WYSIWYG inserter
92
+ $ placeholder_templating = $ zbs ->get_templating ();
93
+ $ placeholder_list = $ placeholder_templating ->get_placeholders_for_tooling ( array ( 'quote ' , 'contact ' , 'global ' ), false , false );
94
+ echo '<script>var jpcrm_placeholder_list = ' . wp_json_encode ( $ placeholder_templating ->simplify_placeholders_for_wysiwyg ( $ placeholder_list ) ) . ';</script> ' ;
95
+
96
+ // for mvp v3.0 we now just hard-type these, as there a lesser obj rarely used.
97
+ $ fields = array (
98
+
99
+ 'title ' => array (
100
+ 0 => 'text ' ,
101
+ 1 => __ ( 'Template Title ' , 'zero-bs-crm ' ),
102
+ 2 => '' , // placeholder
103
+ 'essential ' => 1 ,
104
+ ),
105
+
106
+ 'value ' => array (
107
+ 0 => 'price ' ,
108
+ 1 => __ ( 'Starting Value ' , 'zero-bs-crm ' ),
109
+ 2 => '' , // placeholder
110
+ 'essential ' => 1 ,
111
+ ),
112
+
113
+ 'notes ' => array (
114
+ 0 => 'textarea ' ,
115
+ 1 => __ ( 'Notes ' , 'zero-bs-crm ' ),
116
+ 2 => '' , // placeholder
117
+ 'essential ' => 1 ,
118
+ ),
119
+ );
120
+
121
+ ?>
122
+ <div>
123
+ <div class="jpcrm-form-grid" id="wptbpMetaBoxMainItem">
124
+ <?php
125
+ // output fields
126
+ $ skip_fields = array ( 'content ' ); // dealt with below
127
+ zeroBSCRM_html_editFields ( $ quote_template , $ fields , 'zbsqt_ ' , $ skip_fields );
128
+ ##WLREMOVE
129
+ // template placeholder helper
130
+ echo '<div class="jpcrm-form-group jpcrm-form-group-span-2" style="text-align:end;"><span class="ui basic black label"> ' . esc_html__ ( 'Did you know: You can now use Quote Placeholders? ' , 'zero-bs-crm ' ) . ' <a href=" ' . esc_url ( $ zbs ->urls ['kbquoteplaceholders ' ] ) . '" target="_blank"> ' . esc_html__ ( 'Read More ' , 'zero-bs-crm ' ) . '</a></span></div> ' ;
131
+ ##/WLREMOVE
122
132
?>
123
- <div>
124
- <div class="jpcrm-form-grid" id="wptbpMetaBoxMainItem">
125
- <?php
126
-
127
- // output fields
128
- $ skipFields = array ('content ' ); // dealt with below
129
- zeroBSCRM_html_editFields ($ quoteTemplate ,$ fields ,'zbsqt_ ' ,$ skipFields );
130
- ##WLREMOVE
131
- // template placeholder helper
132
- echo '<div class="jpcrm-form-group jpcrm-form-group-span-2" style="text-align:end;"><span class="ui basic black label"> ' . esc_html__ ( 'Did you know: You can now use Quote Placeholders? ' , 'zero-bs-crm ' ) . ' <a href=" ' . esc_url ( $ zbs ->urls ['kbquoteplaceholders ' ] ) . '" target="_blank"> ' . esc_html__ ( 'Read More ' , 'zero-bs-crm ' ) . '</a></span></div> ' ;
133
- ##/WLREMOVE
134
-
135
- $ content = wp_kses ( $ quoteTemplateContent , $ zbs ->acceptable_html ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
136
-
137
- echo '<div class="jpcrm-form-group jpcrm-form-group-span-2"> ' ;
138
- // remove "Add contact form" button from Jetpack
139
- remove_action ( 'media_buttons ' , 'grunion_media_button ' , 999 );
140
- wp_editor ( $ content , 'zbs_quotetemplate_content ' , array (
141
- 'editor_height ' => 580
142
- ));
143
- echo '</div> ' ;
144
- ?>
145
- </div></div>
146
- <?php
147
-
148
- }
133
+ </div>
134
+ <?php
135
+ $ content = wp_kses ( $ quote_template_content , $ zbs ->acceptable_html );
136
+
137
+ echo '<div class="jpcrm-form-group jpcrm-form-group-span-2"> ' ;
138
+ // remove "Add contact form" button from Jetpack
139
+ remove_action ( 'media_buttons ' , 'grunion_media_button ' , 999 );
140
+ wp_editor (
141
+ $ content ,
142
+ 'zbs_quotetemplate_content ' ,
143
+ array ( 'editor_height ' => 580 )
144
+ );
145
+ echo '</div> ' ;
146
+ ?>
147
+ </div>
148
+ <?php
149
+ }
149
150
150
151
public function save_data ( $ quoteTemplateID , $ quoteTemplate ) {
151
152
0 commit comments