@@ -39,13 +39,13 @@ |
||
39 | 39 | 'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ), |
40 | 40 | ); |
41 | 41 | |
42 | - $field_options['make_clickable'] = array( |
|
43 | - 'type' => 'checkbox', |
|
44 | - 'merge_tags' => false, |
|
45 | - 'value' => 0, |
|
46 | - 'label' => __( 'Convert text URLs to HTML links', 'gravityview' ), |
|
47 | - 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
|
48 | - ); |
|
42 | + $field_options['make_clickable'] = array( |
|
43 | + 'type' => 'checkbox', |
|
44 | + 'merge_tags' => false, |
|
45 | + 'value' => 0, |
|
46 | + 'label' => __( 'Convert text URLs to HTML links', 'gravityview' ), |
|
47 | + 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
|
48 | + ); |
|
49 | 49 | |
50 | 50 | $field_options['allow_html'] = array( |
51 | 51 | 'type' => 'checkbox', |
@@ -10,107 +10,107 @@ discard block |
||
10 | 10 | * |
11 | 11 | * @var string |
12 | 12 | */ |
13 | - protected $name; |
|
13 | + protected $name; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Field settings |
17 | 17 | * |
18 | 18 | * @var array |
19 | 19 | */ |
20 | - protected $field; |
|
20 | + protected $field; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Field current value |
24 | 24 | * |
25 | 25 | * @var mixed |
26 | 26 | */ |
27 | - protected $value; |
|
28 | - |
|
29 | - function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
30 | - |
|
31 | - $this->name = $name; |
|
32 | - |
|
33 | - $defaults = self::get_field_defaults(); |
|
34 | - |
|
35 | - // Backward compatibility |
|
36 | - if( !empty( $field['choices'] ) ) { |
|
37 | - $field['options'] = $field['choices']; |
|
38 | - unset( $field['choices'] ); |
|
39 | - } |
|
40 | - |
|
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
42 | - |
|
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
44 | - |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Returns the default details for a field option |
|
49 | - * |
|
50 | - * - default // default option value, in case nothing is defined (@deprecated) |
|
51 | - * - desc // option description |
|
52 | - * - value // the option default value |
|
53 | - * - label // the option label |
|
54 | - * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
55 | - * - id // the field id |
|
56 | - * - type // the option type ( text, checkbox, select, ... ) |
|
57 | - * - options // when type is select, define the select options ('choices' is @deprecated) |
|
58 | - * - merge_tags // if the option supports merge tags feature |
|
59 | - * - class // (new) define extra classes for the field |
|
60 | - * - tooltip // |
|
61 | - * |
|
62 | - * @return array |
|
63 | - */ |
|
64 | - public static function get_field_defaults() { |
|
65 | - return array( |
|
66 | - 'desc' => '', |
|
67 | - 'value' => null, |
|
68 | - 'label' => '', |
|
69 | - 'left_label' => null, |
|
70 | - 'id' => null, |
|
71 | - 'type' => 'text', |
|
72 | - 'options' => null, |
|
73 | - 'merge_tags' => true, |
|
74 | - 'class' => '', |
|
75 | - 'tooltip' => null, |
|
76 | - 'requires' => null |
|
77 | - ); |
|
78 | - } |
|
79 | - |
|
80 | - |
|
81 | - function get_tooltip() { |
|
82 | - if( ! function_exists('gform_tooltip') ) { |
|
83 | - return null; |
|
84 | - } |
|
85 | - |
|
86 | - $article = wp_parse_args( \GV\Utils::get( $this->field, 'article', array() ), array( |
|
87 | - 'id' => '', |
|
88 | - 'type' => 'inline', |
|
89 | - 'url' => '#', |
|
90 | - ) ); |
|
91 | - |
|
92 | - return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * Displays the tooltip |
|
97 | - * |
|
98 | - * @since 2.8.1 |
|
99 | - * |
|
100 | - * @global $__gf_tooltips |
|
101 | - * |
|
102 | - * @param string $name The name of the tooltip to be displayed |
|
103 | - * @param string $css_class Optional. The CSS class to apply toi the element. Defaults to empty string. |
|
104 | - * @param bool $return Optional. If the tooltip should be returned instead of output. Defaults to false (output) |
|
105 | - * @param array $article Optional. Details about support doc article connected to the tooltip. { |
|
106 | - * @type string $id Unique ID of article for Beacon API |
|
107 | - * @type string $url URL of support doc article |
|
108 | - * @type string $type Type of Beacon element to open. {@see https://developer.helpscout.com/beacon-2/web/javascript-api/#beaconarticle} |
|
109 | - * } |
|
110 | - * |
|
111 | - * @return string |
|
112 | - */ |
|
113 | - function tooltip( $name, $css_class = '', $return = false, $article = array() ) { |
|
27 | + protected $value; |
|
28 | + |
|
29 | + function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
30 | + |
|
31 | + $this->name = $name; |
|
32 | + |
|
33 | + $defaults = self::get_field_defaults(); |
|
34 | + |
|
35 | + // Backward compatibility |
|
36 | + if( !empty( $field['choices'] ) ) { |
|
37 | + $field['options'] = $field['choices']; |
|
38 | + unset( $field['choices'] ); |
|
39 | + } |
|
40 | + |
|
41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
42 | + |
|
43 | + $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
44 | + |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Returns the default details for a field option |
|
49 | + * |
|
50 | + * - default // default option value, in case nothing is defined (@deprecated) |
|
51 | + * - desc // option description |
|
52 | + * - value // the option default value |
|
53 | + * - label // the option label |
|
54 | + * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
55 | + * - id // the field id |
|
56 | + * - type // the option type ( text, checkbox, select, ... ) |
|
57 | + * - options // when type is select, define the select options ('choices' is @deprecated) |
|
58 | + * - merge_tags // if the option supports merge tags feature |
|
59 | + * - class // (new) define extra classes for the field |
|
60 | + * - tooltip // |
|
61 | + * |
|
62 | + * @return array |
|
63 | + */ |
|
64 | + public static function get_field_defaults() { |
|
65 | + return array( |
|
66 | + 'desc' => '', |
|
67 | + 'value' => null, |
|
68 | + 'label' => '', |
|
69 | + 'left_label' => null, |
|
70 | + 'id' => null, |
|
71 | + 'type' => 'text', |
|
72 | + 'options' => null, |
|
73 | + 'merge_tags' => true, |
|
74 | + 'class' => '', |
|
75 | + 'tooltip' => null, |
|
76 | + 'requires' => null |
|
77 | + ); |
|
78 | + } |
|
79 | + |
|
80 | + |
|
81 | + function get_tooltip() { |
|
82 | + if( ! function_exists('gform_tooltip') ) { |
|
83 | + return null; |
|
84 | + } |
|
85 | + |
|
86 | + $article = wp_parse_args( \GV\Utils::get( $this->field, 'article', array() ), array( |
|
87 | + 'id' => '', |
|
88 | + 'type' => 'inline', |
|
89 | + 'url' => '#', |
|
90 | + ) ); |
|
91 | + |
|
92 | + return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * Displays the tooltip |
|
97 | + * |
|
98 | + * @since 2.8.1 |
|
99 | + * |
|
100 | + * @global $__gf_tooltips |
|
101 | + * |
|
102 | + * @param string $name The name of the tooltip to be displayed |
|
103 | + * @param string $css_class Optional. The CSS class to apply toi the element. Defaults to empty string. |
|
104 | + * @param bool $return Optional. If the tooltip should be returned instead of output. Defaults to false (output) |
|
105 | + * @param array $article Optional. Details about support doc article connected to the tooltip. { |
|
106 | + * @type string $id Unique ID of article for Beacon API |
|
107 | + * @type string $url URL of support doc article |
|
108 | + * @type string $type Type of Beacon element to open. {@see https://developer.helpscout.com/beacon-2/web/javascript-api/#beaconarticle} |
|
109 | + * } |
|
110 | + * |
|
111 | + * @return string |
|
112 | + */ |
|
113 | + function tooltip( $name, $css_class = '', $return = false, $article = array() ) { |
|
114 | 114 | global $__gf_tooltips; //declared as global to improve WPML performance |
115 | 115 | |
116 | 116 | $css_class = empty( $css_class ) ? 'tooltip' : $css_class; |
@@ -128,17 +128,17 @@ discard block |
||
128 | 128 | $tooltip_class = isset( $__gf_tooltips[ $name ] ) ? "tooltip_{$name}" : ''; |
129 | 129 | $tooltip_class = esc_attr( $tooltip_class ); |
130 | 130 | |
131 | - /** |
|
132 | - * Below this line has been modified by GravityView. |
|
133 | - */ |
|
131 | + /** |
|
132 | + * Below this line has been modified by GravityView. |
|
133 | + */ |
|
134 | 134 | |
135 | 135 | if ( empty( $tooltip_text ) && empty( $article['id'] ) ) { |
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | |
139 | 139 | $url = '#'; |
140 | - $atts = 'onclick="return false;" onkeypress="return false;"'; |
|
141 | - $anchor_text = '<i class=\'fa fa-question-circle\'></i>'; |
|
140 | + $atts = 'onclick="return false;" onkeypress="return false;"'; |
|
141 | + $anchor_text = '<i class=\'fa fa-question-circle\'></i>'; |
|
142 | 142 | $css_class = gravityview_sanitize_html_class( 'gf_tooltip ' . $css_class . ' ' . $tooltip_class ); |
143 | 143 | |
144 | 144 | $tooltip = sprintf( '<a href="%s" %s class="%s" title="%s" role="button">%s</a>', |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | $anchor_text |
150 | 150 | ); |
151 | 151 | |
152 | - /** |
|
153 | - * Modify the tooltip HTML before outputting |
|
154 | - * @internal |
|
155 | - * @see GravityView_Support_Port::maybe_add_article_to_tooltip() |
|
156 | - */ |
|
152 | + /** |
|
153 | + * Modify the tooltip HTML before outputting |
|
154 | + * @internal |
|
155 | + * @see GravityView_Support_Port::maybe_add_article_to_tooltip() |
|
156 | + */ |
|
157 | 157 | $tooltip = apply_filters( 'gravityview/tooltips/tooltip', $tooltip, $article, $url, $atts, $css_class, $tooltip_text, $anchor_text ); |
158 | 158 | |
159 | 159 | if ( ! $return ) { |
@@ -163,84 +163,84 @@ discard block |
||
163 | 163 | return $tooltip; |
164 | 164 | } |
165 | 165 | |
166 | - /** |
|
167 | - * Build input id based on the name |
|
168 | - * @return string |
|
169 | - */ |
|
170 | - function get_field_id() { |
|
171 | - if( isset( $this->field['id'] ) ) { |
|
172 | - return esc_attr( $this->field['id'] ); |
|
173 | - } |
|
174 | - return esc_attr( sanitize_html_class( $this->name ) ); |
|
175 | - } |
|
176 | - |
|
177 | - /** |
|
178 | - * Retrieve field label |
|
179 | - * @return string |
|
180 | - */ |
|
181 | - function get_field_label() { |
|
182 | - return esc_html( trim( $this->field['label'] ) ); |
|
183 | - } |
|
166 | + /** |
|
167 | + * Build input id based on the name |
|
168 | + * @return string |
|
169 | + */ |
|
170 | + function get_field_id() { |
|
171 | + if( isset( $this->field['id'] ) ) { |
|
172 | + return esc_attr( $this->field['id'] ); |
|
173 | + } |
|
174 | + return esc_attr( sanitize_html_class( $this->name ) ); |
|
175 | + } |
|
176 | + |
|
177 | + /** |
|
178 | + * Retrieve field label |
|
179 | + * @return string |
|
180 | + */ |
|
181 | + function get_field_label() { |
|
182 | + return esc_html( trim( $this->field['label'] ) ); |
|
183 | + } |
|
184 | 184 | |
185 | 185 | /** |
186 | 186 | * Retrieve field left label |
187 | - * |
|
188 | - * @since 1.7 |
|
189 | - * |
|
187 | + * |
|
188 | + * @since 1.7 |
|
189 | + * |
|
190 | 190 | * @return string |
191 | 191 | */ |
192 | 192 | function get_field_left_label() { |
193 | 193 | return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
194 | 194 | } |
195 | 195 | |
196 | - /** |
|
197 | - * Retrieve field label class |
|
198 | - * @return string |
|
199 | - */ |
|
200 | - function get_label_class() { |
|
201 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
202 | - } |
|
203 | - |
|
204 | - |
|
205 | - /** |
|
206 | - * Retrieve field description |
|
207 | - * @return string |
|
208 | - */ |
|
209 | - function get_field_desc() { |
|
210 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - /** |
|
215 | - * Verify if field should have merge tags |
|
216 | - * @return boolean |
|
217 | - */ |
|
218 | - function show_merge_tags() { |
|
219 | - // Show the merge tags if the field is a list view |
|
220 | - $is_list = preg_match( '/_list-/ism', $this->name ); |
|
221 | - // Or is a single entry view |
|
222 | - $is_single = preg_match( '/single_/ism', $this->name ); |
|
223 | - |
|
224 | - return ( $is_single || $is_list ); |
|
225 | - } |
|
226 | - |
|
227 | - |
|
228 | - |
|
229 | - /** |
|
230 | - * important! Override this class |
|
231 | - * outputs the field option html |
|
232 | - */ |
|
233 | - function render_option() { |
|
234 | - // to replace on each field |
|
235 | - } |
|
236 | - |
|
237 | - /** |
|
238 | - * important! Override this class if needed |
|
239 | - * outputs the field setting html |
|
240 | - */ |
|
241 | - function render_setting( $override_input = NULL ) { |
|
242 | - |
|
243 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
196 | + /** |
|
197 | + * Retrieve field label class |
|
198 | + * @return string |
|
199 | + */ |
|
200 | + function get_label_class() { |
|
201 | + return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
202 | + } |
|
203 | + |
|
204 | + |
|
205 | + /** |
|
206 | + * Retrieve field description |
|
207 | + * @return string |
|
208 | + */ |
|
209 | + function get_field_desc() { |
|
210 | + return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + /** |
|
215 | + * Verify if field should have merge tags |
|
216 | + * @return boolean |
|
217 | + */ |
|
218 | + function show_merge_tags() { |
|
219 | + // Show the merge tags if the field is a list view |
|
220 | + $is_list = preg_match( '/_list-/ism', $this->name ); |
|
221 | + // Or is a single entry view |
|
222 | + $is_single = preg_match( '/single_/ism', $this->name ); |
|
223 | + |
|
224 | + return ( $is_single || $is_list ); |
|
225 | + } |
|
226 | + |
|
227 | + |
|
228 | + |
|
229 | + /** |
|
230 | + * important! Override this class |
|
231 | + * outputs the field option html |
|
232 | + */ |
|
233 | + function render_option() { |
|
234 | + // to replace on each field |
|
235 | + } |
|
236 | + |
|
237 | + /** |
|
238 | + * important! Override this class if needed |
|
239 | + * outputs the field setting html |
|
240 | + */ |
|
241 | + function render_setting( $override_input = NULL ) { |
|
242 | + |
|
243 | + if( !empty( $this->field['full_width'] ) ) { ?> |
|
244 | 244 | <th scope="row" colspan="2"> |
245 | 245 | <div> |
246 | 246 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | </td> |
261 | 261 | <?php } |
262 | 262 | |
263 | - } |
|
263 | + } |
|
264 | 264 | |
265 | - /** |
|
266 | - * important! Override this class |
|
267 | - * outputs the input html part |
|
268 | - */ |
|
269 | - function render_input( $override_input ) { |
|
270 | - echo ''; |
|
271 | - } |
|
265 | + /** |
|
266 | + * important! Override this class |
|
267 | + * outputs the input html part |
|
268 | + */ |
|
269 | + function render_input( $override_input ) { |
|
270 | + echo ''; |
|
271 | + } |
|
272 | 272 | |
273 | 273 | } |
@@ -10,42 +10,42 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | if ( ! defined( 'WPINC' ) ) { |
13 | - die; |
|
13 | + die; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | |
17 | 17 | class GravityView_Edit_Entry_Admin { |
18 | 18 | |
19 | - protected $loader; |
|
19 | + protected $loader; |
|
20 | 20 | |
21 | - function __construct( GravityView_Edit_Entry $loader ) { |
|
22 | - $this->loader = $loader; |
|
23 | - } |
|
21 | + function __construct( GravityView_Edit_Entry $loader ) { |
|
22 | + $this->loader = $loader; |
|
23 | + } |
|
24 | 24 | |
25 | - function load() { |
|
25 | + function load() { |
|
26 | 26 | |
27 | - if( !is_admin() ) { |
|
28 | - return; |
|
29 | - } |
|
27 | + if( !is_admin() ) { |
|
28 | + return; |
|
29 | + } |
|
30 | 30 | |
31 | - // Add Edit Link as a default field, outside those set in the Gravity Form form |
|
32 | - add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
|
31 | + // Add Edit Link as a default field, outside those set in the Gravity Form form |
|
32 | + add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
|
33 | 33 | |
34 | - // For the Edit Entry Link, you don't want visible to all users. |
|
35 | - add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 ); |
|
34 | + // For the Edit Entry Link, you don't want visible to all users. |
|
35 | + add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 ); |
|
36 | 36 | |
37 | - // Modify the field options based on the name of the field type |
|
38 | - add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 ); |
|
37 | + // Modify the field options based on the name of the field type |
|
38 | + add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 ); |
|
39 | 39 | |
40 | - // add tooltips |
|
41 | - add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') ); |
|
40 | + // add tooltips |
|
41 | + add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') ); |
|
42 | 42 | |
43 | - // custom fields' options for zone EDIT |
|
44 | - add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 ); |
|
43 | + // custom fields' options for zone EDIT |
|
44 | + add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 ); |
|
45 | 45 | |
46 | - // Add Edit Entry settings to View Settings |
|
47 | - add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) ); |
|
48 | - } |
|
46 | + // Add Edit Entry settings to View Settings |
|
47 | + add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) ); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Render Edit Entry View metabox settings |
@@ -69,141 +69,141 @@ discard block |
||
69 | 69 | GravityView_Render_Settings::render_setting_row( 'edit_redirect_url', $current_settings ); |
70 | 70 | } |
71 | 71 | |
72 | - /** |
|
73 | - * Add Edit Link as a default field, outside those set in the Gravity Form form |
|
74 | - * @param array $entry_default_fields Existing fields |
|
75 | - * @param string|array $form form_ID or form object |
|
76 | - * @param string $zone Either 'single', 'directory', 'header', 'footer' |
|
77 | - */ |
|
78 | - function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
|
79 | - |
|
80 | - if( $zone !== 'edit' ) { |
|
81 | - |
|
82 | - $entry_default_fields['edit_link'] = array( |
|
83 | - 'label' => __('Edit Entry', 'gravityview'), |
|
84 | - 'type' => 'edit_link', |
|
85 | - 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
86 | - ); |
|
87 | - |
|
88 | - } |
|
89 | - |
|
90 | - return $entry_default_fields; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * Change wording for the Edit context to read Entry Creator |
|
95 | - * |
|
96 | - * @param array $visibility_caps Array of capabilities to display in field dropdown. |
|
97 | - * @param string $field_type Type of field options to render (`field` or `widget`) |
|
98 | - * @param string $template_id Table slug |
|
99 | - * @param float $field_id GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by` |
|
100 | - * @param string $context What context are we in? Example: `single` or `directory` |
|
101 | - * @param string $input_type (textarea, list, select, etc.) |
|
102 | - * @return array Array of field options with `label`, `value`, `type`, `default` keys |
|
103 | - */ |
|
104 | - function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
105 | - |
|
106 | - $caps = $visibility_caps; |
|
107 | - |
|
108 | - // If we're configuring fields in the edit context, we want a limited selection |
|
109 | - if( $context === 'edit' ) { |
|
110 | - |
|
111 | - // Remove other built-in caps. |
|
112 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
113 | - |
|
114 | - $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
115 | - } |
|
116 | - |
|
117 | - return $caps; |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * Add "Edit Link Text" setting to the edit_link field settings |
|
122 | - * @param [type] $field_options [description] |
|
123 | - * @param [type] $template_id [description] |
|
124 | - * @param [type] $field_id [description] |
|
125 | - * @param [type] $context [description] |
|
126 | - * @param [type] $input_type [description] |
|
127 | - * @return [type] [description] |
|
128 | - */ |
|
129 | - function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
130 | - |
|
131 | - // Always a link, never a filter |
|
132 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
133 | - |
|
134 | - // Edit Entry link should only appear to visitors capable of editing entries |
|
135 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
136 | - |
|
137 | - $add_option['edit_link'] = array( |
|
138 | - 'type' => 'text', |
|
139 | - 'label' => __( 'Edit Link Text', 'gravityview' ), |
|
140 | - 'desc' => NULL, |
|
141 | - 'value' => __('Edit Entry', 'gravityview'), |
|
142 | - 'merge_tags' => true, |
|
143 | - ); |
|
144 | - |
|
145 | - return array_merge( $add_option, $field_options ); |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * Add tooltips |
|
150 | - * @param array $tooltips Existing tooltips |
|
151 | - * @return array Modified tooltips |
|
152 | - */ |
|
153 | - function tooltips( $tooltips ) { |
|
154 | - |
|
155 | - $return = $tooltips; |
|
156 | - |
|
157 | - $return['allow_edit_cap'] = array( |
|
158 | - 'title' => __('Limiting Edit Access', 'gravityview'), |
|
159 | - 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
160 | - ); |
|
161 | - |
|
162 | - return $return; |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * Manipulate the fields' options for the EDIT ENTRY screen |
|
167 | - * @param [type] $field_options [description] |
|
168 | - * @param [type] $template_id [description] |
|
169 | - * @param [type] $field_id [description] |
|
170 | - * @param [type] $context [description] |
|
171 | - * @param [type] $input_type [description] |
|
172 | - * @return [type] [description] |
|
173 | - */ |
|
72 | + /** |
|
73 | + * Add Edit Link as a default field, outside those set in the Gravity Form form |
|
74 | + * @param array $entry_default_fields Existing fields |
|
75 | + * @param string|array $form form_ID or form object |
|
76 | + * @param string $zone Either 'single', 'directory', 'header', 'footer' |
|
77 | + */ |
|
78 | + function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
|
79 | + |
|
80 | + if( $zone !== 'edit' ) { |
|
81 | + |
|
82 | + $entry_default_fields['edit_link'] = array( |
|
83 | + 'label' => __('Edit Entry', 'gravityview'), |
|
84 | + 'type' => 'edit_link', |
|
85 | + 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
86 | + ); |
|
87 | + |
|
88 | + } |
|
89 | + |
|
90 | + return $entry_default_fields; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * Change wording for the Edit context to read Entry Creator |
|
95 | + * |
|
96 | + * @param array $visibility_caps Array of capabilities to display in field dropdown. |
|
97 | + * @param string $field_type Type of field options to render (`field` or `widget`) |
|
98 | + * @param string $template_id Table slug |
|
99 | + * @param float $field_id GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by` |
|
100 | + * @param string $context What context are we in? Example: `single` or `directory` |
|
101 | + * @param string $input_type (textarea, list, select, etc.) |
|
102 | + * @return array Array of field options with `label`, `value`, `type`, `default` keys |
|
103 | + */ |
|
104 | + function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
105 | + |
|
106 | + $caps = $visibility_caps; |
|
107 | + |
|
108 | + // If we're configuring fields in the edit context, we want a limited selection |
|
109 | + if( $context === 'edit' ) { |
|
110 | + |
|
111 | + // Remove other built-in caps. |
|
112 | + unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
113 | + |
|
114 | + $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
115 | + } |
|
116 | + |
|
117 | + return $caps; |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * Add "Edit Link Text" setting to the edit_link field settings |
|
122 | + * @param [type] $field_options [description] |
|
123 | + * @param [type] $template_id [description] |
|
124 | + * @param [type] $field_id [description] |
|
125 | + * @param [type] $context [description] |
|
126 | + * @param [type] $input_type [description] |
|
127 | + * @return [type] [description] |
|
128 | + */ |
|
129 | + function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
130 | + |
|
131 | + // Always a link, never a filter |
|
132 | + unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
133 | + |
|
134 | + // Edit Entry link should only appear to visitors capable of editing entries |
|
135 | + unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
136 | + |
|
137 | + $add_option['edit_link'] = array( |
|
138 | + 'type' => 'text', |
|
139 | + 'label' => __( 'Edit Link Text', 'gravityview' ), |
|
140 | + 'desc' => NULL, |
|
141 | + 'value' => __('Edit Entry', 'gravityview'), |
|
142 | + 'merge_tags' => true, |
|
143 | + ); |
|
144 | + |
|
145 | + return array_merge( $add_option, $field_options ); |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * Add tooltips |
|
150 | + * @param array $tooltips Existing tooltips |
|
151 | + * @return array Modified tooltips |
|
152 | + */ |
|
153 | + function tooltips( $tooltips ) { |
|
154 | + |
|
155 | + $return = $tooltips; |
|
156 | + |
|
157 | + $return['allow_edit_cap'] = array( |
|
158 | + 'title' => __('Limiting Edit Access', 'gravityview'), |
|
159 | + 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
160 | + ); |
|
161 | + |
|
162 | + return $return; |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * Manipulate the fields' options for the EDIT ENTRY screen |
|
167 | + * @param [type] $field_options [description] |
|
168 | + * @param [type] $template_id [description] |
|
169 | + * @param [type] $field_id [description] |
|
170 | + * @param [type] $context [description] |
|
171 | + * @param [type] $input_type [description] |
|
172 | + * @return [type] [description] |
|
173 | + */ |
|
174 | 174 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
175 | 175 | |
176 | - // We only want to modify the settings for the edit context |
|
177 | - if( 'edit' !== $context ) { |
|
178 | - |
|
179 | - /** |
|
180 | - * @since 1.8.4 |
|
181 | - */ |
|
182 | - $field_options['new_window'] = array( |
|
183 | - 'type' => 'checkbox', |
|
184 | - 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
185 | - 'value' => false, |
|
186 | - ); |
|
187 | - |
|
188 | - return $field_options; |
|
189 | - } |
|
190 | - |
|
191 | - // Entry field is only for logged in users |
|
192 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
193 | - |
|
194 | - $add_options = array( |
|
195 | - 'allow_edit_cap' => array( |
|
196 | - 'type' => 'select', |
|
197 | - 'label' => __( 'Make field editable to:', 'gravityview' ), |
|
198 | - 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
|
199 | - 'tooltip' => 'allow_edit_cap', |
|
200 | - 'class' => 'widefat', |
|
201 | - 'value' => 'read', // Default: entry creator |
|
202 | - ), |
|
203 | - ); |
|
204 | - |
|
205 | - return array_merge( $field_options, $add_options ); |
|
206 | - } |
|
176 | + // We only want to modify the settings for the edit context |
|
177 | + if( 'edit' !== $context ) { |
|
178 | + |
|
179 | + /** |
|
180 | + * @since 1.8.4 |
|
181 | + */ |
|
182 | + $field_options['new_window'] = array( |
|
183 | + 'type' => 'checkbox', |
|
184 | + 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
185 | + 'value' => false, |
|
186 | + ); |
|
187 | + |
|
188 | + return $field_options; |
|
189 | + } |
|
190 | + |
|
191 | + // Entry field is only for logged in users |
|
192 | + unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
193 | + |
|
194 | + $add_options = array( |
|
195 | + 'allow_edit_cap' => array( |
|
196 | + 'type' => 'select', |
|
197 | + 'label' => __( 'Make field editable to:', 'gravityview' ), |
|
198 | + 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
|
199 | + 'tooltip' => 'allow_edit_cap', |
|
200 | + 'class' => 'widefat', |
|
201 | + 'value' => 'read', // Default: entry creator |
|
202 | + ), |
|
203 | + ); |
|
204 | + |
|
205 | + return array_merge( $field_options, $add_options ); |
|
206 | + } |
|
207 | 207 | |
208 | 208 | |
209 | 209 | } // end class |
@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function add_network_menu() { |
136 | 136 | |
137 | - if ( ! gravityview()->plugin->is_network_activated() ) { |
|
137 | + if ( ! gravityview()->plugin->is_network_activated() ) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
141 | + add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | - * Uninstall all traces of GravityView |
|
146 | - * |
|
147 | - * Note: method is public because parent method is public |
|
148 | - * |
|
145 | + * Uninstall all traces of GravityView |
|
146 | + * |
|
147 | + * Note: method is public because parent method is public |
|
148 | + * |
|
149 | 149 | * @return bool |
150 | 150 | */ |
151 | 151 | public function uninstall() { |
152 | 152 | gravityview()->plugin->uninstall(); |
153 | 153 | |
154 | 154 | /** |
155 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | - * @see GFAddOn::uninstall_addon |
|
157 | - * @uses deactivate_plugins() |
|
158 | - */ |
|
155 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | + * @see GFAddOn::uninstall_addon |
|
157 | + * @uses deactivate_plugins() |
|
158 | + */ |
|
159 | 159 | $this->_path = GRAVITYVIEW_FILE; |
160 | 160 | |
161 | 161 | return true; |
@@ -185,42 +185,42 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
188 | - * Get an array of reasons why the plugin might be uninstalled |
|
189 | - * |
|
190 | - * @since 1.17.5 |
|
191 | - * |
|
188 | + * Get an array of reasons why the plugin might be uninstalled |
|
189 | + * |
|
190 | + * @since 1.17.5 |
|
191 | + * |
|
192 | 192 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
193 | 193 | */ |
194 | 194 | private function get_uninstall_reasons() { |
195 | 195 | $reasons = array( |
196 | 196 | 'will-continue' => array( |
197 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | - ), |
|
197 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | + ), |
|
199 | 199 | 'no-longer-need' => array( |
200 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | - ), |
|
200 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | + ), |
|
202 | 202 | 'doesnt-work' => array( |
203 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | - ), |
|
203 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | + ), |
|
205 | 205 | 'found-other' => array( |
206 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | - 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | - ), |
|
206 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | + ), |
|
209 | 209 | 'other' => array( |
210 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | - ), |
|
210 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | + ), |
|
212 | 212 | ); |
213 | 213 | |
214 | 214 | shuffle( $reasons ); |
215 | 215 | |
216 | 216 | return $reasons; |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | /** |
220 | - * Display a feedback form when the plugin is uninstalled |
|
221 | - * |
|
222 | - * @since 1.17.5 |
|
223 | - * |
|
220 | + * Display a feedback form when the plugin is uninstalled |
|
221 | + * |
|
222 | + * @since 1.17.5 |
|
223 | + * |
|
224 | 224 | * @return string HTML of the uninstallation form |
225 | 225 | */ |
226 | 226 | public function uninstall_form() { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
301 | 301 | <ul> |
302 | 302 | <?php |
303 | - $reasons = $this->get_uninstall_reasons(); |
|
303 | + $reasons = $this->get_uninstall_reasons(); |
|
304 | 304 | foreach ( $reasons as $reason ) { |
305 | 305 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) ); |
306 | 306 | } |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | public function app_settings_tab() { |
397 | - parent::app_settings_tab(); |
|
397 | + parent::app_settings_tab(); |
|
398 | 398 | |
399 | 399 | if ( $this->maybe_uninstall() ) { |
400 | - echo $this->uninstall_form(); |
|
400 | + echo $this->uninstall_form(); |
|
401 | 401 | } |
402 | - } |
|
402 | + } |
|
403 | 403 | |
404 | 404 | /** |
405 | 405 | * The Settings title |
@@ -562,8 +562,8 @@ discard block |
||
562 | 562 | type="' . $field['type'] . '" |
563 | 563 | name="' . esc_attr( $name ) . '" |
564 | 564 | value="' . $value . '" ' . |
565 | - implode( ' ', $attributes ) . |
|
566 | - ' />'; |
|
565 | + implode( ' ', $attributes ) . |
|
566 | + ' />'; |
|
567 | 567 | |
568 | 568 | if ( $echo ) { |
569 | 569 | echo $html; |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | } |
582 | 582 | |
583 | 583 | /** |
584 | - * Check whether GravityView is being saved |
|
585 | - * |
|
586 | - * The generic is_save_postback() is true for all addons |
|
587 | - * |
|
588 | - * @since 2.0.8 |
|
589 | - * |
|
584 | + * Check whether GravityView is being saved |
|
585 | + * |
|
586 | + * The generic is_save_postback() is true for all addons |
|
587 | + * |
|
588 | + * @since 2.0.8 |
|
589 | + * |
|
590 | 590 | * @return bool |
591 | 591 | */ |
592 | 592 | public function is_save_postback() { |
@@ -600,16 +600,16 @@ discard block |
||
600 | 600 | */ |
601 | 601 | public function license_key_notice() { |
602 | 602 | |
603 | - if( $this->is_save_postback() ) { |
|
604 | - $settings = $this->get_posted_settings(); |
|
605 | - $license_key = defined( 'GRAVITYVIEW_LICENSE_KEY' ) ? GRAVITYVIEW_LICENSE_KEY : \GV\Utils::get( $settings, 'license_key' ); |
|
606 | - $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
607 | - } else { |
|
608 | - $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
609 | - $license_key = $this->get( 'license_key' ); |
|
610 | - } |
|
603 | + if( $this->is_save_postback() ) { |
|
604 | + $settings = $this->get_posted_settings(); |
|
605 | + $license_key = defined( 'GRAVITYVIEW_LICENSE_KEY' ) ? GRAVITYVIEW_LICENSE_KEY : \GV\Utils::get( $settings, 'license_key' ); |
|
606 | + $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
607 | + } else { |
|
608 | + $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
609 | + $license_key = $this->get( 'license_key' ); |
|
610 | + } |
|
611 | 611 | |
612 | - $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
612 | + $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
613 | 613 | |
614 | 614 | $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
615 | 615 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $update_below = false; |
627 | 627 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
628 | 628 | |
629 | - switch ( $license_status ) { |
|
629 | + switch ( $license_status ) { |
|
630 | 630 | /** @since 1.17 */ |
631 | 631 | case 'expired': |
632 | 632 | $title = __( 'Expired License', 'gravityview' ); |
@@ -664,13 +664,13 @@ discard block |
||
664 | 664 | return; |
665 | 665 | } |
666 | 666 | |
667 | - \GravityView_Admin_Notices::add_notice( array( |
|
668 | - 'message' => $message, |
|
669 | - 'class' => 'notice notice-warning', |
|
670 | - 'title' => $title, |
|
671 | - 'cap' => 'gravityview_edit_settings', |
|
672 | - 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
673 | - ) ); |
|
667 | + \GravityView_Admin_Notices::add_notice( array( |
|
668 | + 'message' => $message, |
|
669 | + 'class' => 'notice notice-warning', |
|
670 | + 'title' => $title, |
|
671 | + 'cap' => 'gravityview_edit_settings', |
|
672 | + 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
673 | + ) ); |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | /** |
@@ -684,12 +684,12 @@ discard block |
||
684 | 684 | } |
685 | 685 | |
686 | 686 | /** |
687 | - * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
688 | - * |
|
689 | - * @since 1.21.5 |
|
690 | - * |
|
691 | - * @see GFAddOn::scripts() |
|
692 | - * |
|
687 | + * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
688 | + * |
|
689 | + * @since 1.21.5 |
|
690 | + * |
|
691 | + * @see GFAddOn::scripts() |
|
692 | + * |
|
693 | 693 | * @return array Array of scripts |
694 | 694 | */ |
695 | 695 | public function scripts() { |
@@ -698,10 +698,10 @@ discard block |
||
698 | 698 | $scripts[] = array( |
699 | 699 | 'handle' => 'gform_tooltip_init', |
700 | 700 | 'enqueue' => array( |
701 | - array( |
|
702 | - 'admin_page' => array( 'app_settings' ) |
|
703 | - ) |
|
704 | - ) |
|
701 | + array( |
|
702 | + 'admin_page' => array( 'app_settings' ) |
|
703 | + ) |
|
704 | + ) |
|
705 | 705 | ); |
706 | 706 | |
707 | 707 | return $scripts; |
@@ -719,10 +719,10 @@ discard block |
||
719 | 719 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
720 | 720 | 'version' => Plugin::$version, |
721 | 721 | 'deps' => array( |
722 | - 'gform_admin', |
|
722 | + 'gform_admin', |
|
723 | 723 | 'gaddon_form_settings_css', |
724 | - 'gform_tooltip', |
|
725 | - 'gform_font_awesome', |
|
724 | + 'gform_tooltip', |
|
725 | + 'gform_font_awesome', |
|
726 | 726 | ), |
727 | 727 | 'enqueue' => array( |
728 | 728 | array( 'admin_page' => array( |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | array( |
891 | 891 | 'label' => esc_html__( 'Show me beta versions if they are available.', 'gravityview' ), |
892 | 892 | 'value' => '1', |
893 | - 'name' => 'beta', |
|
893 | + 'name' => 'beta', |
|
894 | 894 | ), |
895 | 895 | ), |
896 | 896 | 'description' => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ), |
@@ -928,38 +928,38 @@ discard block |
||
928 | 928 | |
929 | 929 | if ( empty( $field['disabled'] ) ) { |
930 | 930 | unset( $field['disabled'] ); |
931 | - } |
|
931 | + } |
|
932 | 932 | } |
933 | 933 | |
934 | - $sections = array( |
|
935 | - array( |
|
936 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
937 | - 'fields' => $fields, |
|
938 | - ) |
|
939 | - ); |
|
934 | + $sections = array( |
|
935 | + array( |
|
936 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
937 | + 'fields' => $fields, |
|
938 | + ) |
|
939 | + ); |
|
940 | 940 | |
941 | - // custom 'update settings' button |
|
942 | - $button = array( |
|
943 | - 'class' => 'button button-primary button-hero', |
|
944 | - 'type' => 'save', |
|
945 | - ); |
|
941 | + // custom 'update settings' button |
|
942 | + $button = array( |
|
943 | + 'class' => 'button button-primary button-hero', |
|
944 | + 'type' => 'save', |
|
945 | + ); |
|
946 | 946 | |
947 | 947 | if ( $disabled_attribute ) { |
948 | 948 | $button['disabled'] = $disabled_attribute; |
949 | 949 | } |
950 | 950 | |
951 | - /** |
|
952 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
953 | - * Extensions can tap in here to insert their own section and settings. |
|
954 | - * <code> |
|
955 | - * $sections[] = array( |
|
956 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
957 | - * 'fields' => $settings, |
|
958 | - * ); |
|
959 | - * </code> |
|
960 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
961 | - */ |
|
962 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
951 | + /** |
|
952 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
953 | + * Extensions can tap in here to insert their own section and settings. |
|
954 | + * <code> |
|
955 | + * $sections[] = array( |
|
956 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
957 | + * 'fields' => $settings, |
|
958 | + * ); |
|
959 | + * </code> |
|
960 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
961 | + */ |
|
962 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
963 | 963 | |
964 | 964 | // If there are extensions, add a section for them |
965 | 965 | if ( ! empty( $extension_sections ) ) { |
@@ -972,13 +972,13 @@ discard block |
||
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
975 | - $k = count( $extension_sections ) - 1 ; |
|
976 | - $extension_sections[ $k ]['fields'][] = $button; |
|
975 | + $k = count( $extension_sections ) - 1 ; |
|
976 | + $extension_sections[ $k ]['fields'][] = $button; |
|
977 | 977 | $sections = array_merge( $sections, $extension_sections ); |
978 | 978 | } else { |
979 | - // add the 'update settings' button to the general section |
|
980 | - $sections[0]['fields'][] = $button; |
|
981 | - } |
|
979 | + // add the 'update settings' button to the general section |
|
980 | + $sections[0]['fields'][] = $button; |
|
981 | + } |
|
982 | 982 | |
983 | 983 | return $sections; |
984 | 984 | } |
@@ -1032,9 +1032,9 @@ discard block |
||
1032 | 1032 | */ |
1033 | 1033 | protected function settings_edd_license( $field, $echo = true ) { |
1034 | 1034 | |
1035 | - if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1036 | - $field['input_type'] = 'password'; |
|
1037 | - } |
|
1035 | + if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1036 | + $field['input_type'] = 'password'; |
|
1037 | + } |
|
1038 | 1038 | |
1039 | 1039 | $text = $this->settings_text( $field, false ); |
1040 | 1040 | |
@@ -1051,9 +1051,9 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | /** |
1053 | 1053 | * Allow pure HTML settings row |
1054 | - * |
|
1055 | - * @since 2.0.6 |
|
1056 | - * |
|
1054 | + * |
|
1055 | + * @since 2.0.6 |
|
1056 | + * |
|
1057 | 1057 | * @param array $field |
1058 | 1058 | * @param bool $echo Whether to echo the |
1059 | 1059 | * |
@@ -1119,19 +1119,19 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | /** |
1122 | - * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1123 | - * |
|
1124 | - * Converts `$field['description']` to `$field['gv_description']` |
|
1125 | - * Converts `$field['subtitle']` to `$field['description']` |
|
1126 | - * |
|
1127 | - * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1128 | - * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1129 | - * |
|
1130 | - * @since 1.21.5.2 |
|
1131 | - * |
|
1122 | + * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1123 | + * |
|
1124 | + * Converts `$field['description']` to `$field['gv_description']` |
|
1125 | + * Converts `$field['subtitle']` to `$field['description']` |
|
1126 | + * |
|
1127 | + * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1128 | + * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1129 | + * |
|
1130 | + * @since 1.21.5.2 |
|
1131 | + * |
|
1132 | 1132 | * @param array $field |
1133 | - * |
|
1134 | - * @return void |
|
1133 | + * |
|
1134 | + * @return void |
|
1135 | 1135 | */ |
1136 | 1136 | public function single_setting_row( $field ) { |
1137 | 1137 | $field['gv_description'] = Utils::get( $field, 'description' ); |