GravityView  2.10.1
The best, easiest way to display Gravity Forms entries on your website.
class-gv-settings-view.php
Go to the documentation of this file.
1 <?php
2 namespace GV;
3 
4 /** If this file is called directly, abort. */
5 if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
6  die();
7 }
8 
9 /**
10  * The View Settings class.
11  */
12 class View_Settings extends Settings {
13  /**
14  * Retrieve an instance of the settings with default values.
15  * @param bool $detailed Whether to return detailed setting meta information or just the value.
16  *
17  * @api
18  * @since 2.0
19  *
20  * @return \GV\View_Settings
21  */
22  public static function with_defaults( $detailed = false ) {
23  $settings = new self();
24  $settings->update( self::defaults( $detailed ) );
25  return $settings;
26  }
27 
28  /**
29  * Retrieve the default View settings.
30  *
31  * @param bool $detailed Whether to return detailed setting meta information or just the value.
32  * @param string $group Retrieve settings of a particular group.
33  *
34  * @api
35  * @since 2.0
36  *
37  * @return array The default settings along with their values.
38  * @param[out] string $label Setting label shown in admin
39  * @param[out] string $type Gravity Forms field type
40  * @param[out] string $group The field group the setting is associated with. Default: "default"
41  * @param[out] mixed $value The default value for the setting
42  * @param[out] string $tooltip Tooltip displayed for the setting
43  * @param[out] boolean $show_in_shortcode Whether to show the setting in the shortcode configuration modal
44  * @param[out] array $options Array of values to use when generating select, multiselect, radio, or checkboxes fields
45  * @param[out] boolean $full_width True: Display the input and label together when rendering. False: Display label and input in separate columns when rendering.
46  */
47  public static function defaults( $detailed = false, $group = null ) {
48 
49  $default_settings = array_merge(
50  array(
51  'id' => array(
52  'label' => __( 'View ID', 'gravityview' ),
53  'type' => 'number',
54  'group' => 'default',
55  'value' => null,
56  'tooltip' => null,
57  'show_in_shortcode' => false,
58  ),
59  'page_size' => array(
60  'label' => __( 'Number of entries per page', 'gravityview' ),
61  'type' => 'number',
62  'class' => 'small-text',
63  'group' => 'default',
64  'value' => 25,
65  'show_in_shortcode' => true,
66  ),
67  'offset' => array(
68  'label' => __( 'Offset entries starting from', 'gravityview' ),
69  'type' => 'number',
70  'class' => 'small-text',
71  'group' => 'default',
72  'value' => 0,
73  'show_in_shortcode' => true,
74  ),
75  'lightbox' => array(
76  'label' => __( 'Enable lightbox for images', 'gravityview' ),
77  'type' => 'checkbox',
78  'group' => 'default',
79  'value' => 1,
80  'tooltip' => __( 'If enabled, images will open full-size in a "lightbox". A lightbox displays images and videos by filling the screen and dimming out the rest of the web page.', 'gravityview' ),
81  'show_in_shortcode' => true,
82  'article' => array(
83  'id' => '5e9a1f8904286364bc98931f',
84  'url' => 'https://docs.gravityview.co/article/705-view-settings-enable-lightbox-for-images',
85  ),
86  ),
87  'show_only_approved' => array(
88  'label' => __( 'Show only approved entries', 'gravityview' ),
89  'type' => 'checkbox',
90  'group' => 'default',
91  'desc' => __( 'By default, only approved entries are displayed in a View. When enabled, this setting prevents unapproved or disapproved entries from appearing in results. If disabled, entries with all approval statuses will be visible, including disapproved entries.', 'gravityview' ),
92  'tooltip' => false,
93  'value' => 1,
94  'show_in_shortcode' => true,
95  'article' => array(
96  'id' => '5bad1a33042863158cc6d396',
97  'url' => 'https://docs.gravityview.co/article/490-entry-approval-gravity-forms',
98  ),
99  ),
100  'no_results_text' => array(
101  'label' => __( '"No Results" Text', 'gravityview' ),
102  'type' => 'text',
103  'group' => 'default',
104  'desc' => '',
105  'tooltip' => false,
106  'value' => '',
107  'placeholder' => __( 'No entries match your request.', 'gravityview' ),
108  'show_in_shortcode' => true,
109  'class' => 'widefat',
110  'full_width' => true,
111  ),
112  'no_search_results_text' => array(
113  'label' => __( '"No Search Results" Text', 'gravityview' ),
114  'type' => 'text',
115  'group' => 'default',
116  'desc' => '',
117  'tooltip' => false,
118  'value' => '',
119  'placeholder' => __( 'This search returned no results.', 'gravityview' ),
120  'show_in_shortcode' => true,
121  'class' => 'widefat',
122  'full_width' => true,
123  ),
124  'admin_show_all_statuses' => array(
125  'label' => __( 'Show all entries to administrators', 'gravityview' ),
126  'desc' => __( 'Administrators will be able to see entries with any approval status.', 'gravityview' ),
127  'tooltip' => __( 'Logged-out visitors and non-administrators will only see approved entries, while administrators will see entries with all statuses. This makes it easier for administrators to moderate entries from a View.', 'gravityview' ),
128  'requires' => 'show_only_approved',
129  'type' => 'checkbox',
130  'group' => 'default',
131  'value' => 0,
132  'show_in_shortcode' => false,
133  ),
134  'hide_until_searched' => array(
135  'label' => __( 'Hide View data until search is performed', 'gravityview' ),
136  'type' => 'checkbox',
137  'group' => 'default',
138  'tooltip' => __( 'When enabled it will only show any View entries after a search is performed.', 'gravityview' ),
139  'value' => 0,
140  'show_in_shortcode' => false,
141  'article' => array(
142  'id' => '5c772fa02c7d3a0cb9320a84',
143  'url' => 'https://docs.gravityview.co/article/536-how-to-hide-results-and-only-display-them-if-a-search-is-performed',
144  ),
145  ),
146  'hide_empty' => array(
147  'label' => __( 'Hide empty fields', 'gravityview' ),
148  'group' => 'default',
149  'type' => 'checkbox',
150  'desc' => __( 'When enabled, empty fields will be not be displayed. If disabled, fields and their labels will be displayed with no content.', 'gravityview' ),
151  'value' => 1,
152  'tooltip' => false,
153  'show_in_shortcode' => false,
154  ),
155  'hide_empty_single' => array(
156  'label' => __( 'Hide empty fields', 'gravityview' ),
157  'group' => 'default',
158  'type' => 'checkbox',
159  'desc' => __( 'When enabled, empty fields will be not be displayed. If disabled, fields and their labels will be displayed with no content.', 'gravityview' ),
160  'value' => 1,
161  'tooltip' => false,
162  'show_in_shortcode' => false,
163  ),
164  'edit_feeds' => array(
165  'label' => __( 'Feeds', 'gravityview' ),
166  'group' => 'default',
167  'type' => 'checkbox',
168  'value' => array(),
169  'show_in_shortcode' => false,
170  ),
171  'user_edit' => array(
172  'label' => __( 'Allow User Edit', 'gravityview' ),
173  'group' => 'default',
174  'desc' => __( 'Allow logged-in users to edit entries they created.', 'gravityview' ) . ' ' . sprintf( __( 'Administrators are able to %s regardless of this setting.', 'gravityview' ), _x( 'edit entries', 'an action that admins can perform', 'gravityview' ) ),
175  'value' => 0,
176  'tooltip' => __( 'Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview' ),
177  'type' => 'checkbox',
178  'show_in_shortcode' => true,
179  'article' => array(
180  'id' => '54c67bbbe4b07997ea3f3f6b',
181  'url' => 'https://docs.gravityview.co/article/77-user-edit-allow-users-to-edit-their-own-entries',
182  ),
183  ),
184  'unapprove_edit' => array(
185  'label' => __( 'Unapprove Entries After Edit', 'gravityview' ),
186  'group' => 'default',
187  'requires' => 'user_edit',
188  'desc' => __( 'When an entry is edited by a non-administrator, reset the approval status to "Unapproved".', 'gravityview' ),
189  'tooltip' => __( 'If the "Show only approved entries" setting is enabled, the entry will need to be re-approved by an administrator before it is shown in the View.', 'gravityview' ),
190  'value' => 0,
191  'type' => 'checkbox',
192  'show_in_shortcode' => true,
193  'article' => array(
194  'id' => '5ddd81d504286364bc923957',
195  'url' => 'https://docs.gravityview.co/article/657-unapproving-edited-entries-automatically',
196  ),
197  ),
198  'user_delete' => array(
199  'label' => __( 'Allow User Delete', 'gravityview' ),
200  'group' => 'default',
201  'desc' => __( 'Allow logged-in users to delete entries they created.', 'gravityview' ) . ' ' . sprintf( __( 'Administrators are able to %s regardless of this setting.', 'gravityview' ), _x( 'delete entries', 'an action that admins can perform', 'gravityview' ) ),
202  'value' => 0,
203  'tooltip' => __( 'Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview' ),
204  'type' => 'checkbox',
205  'show_in_shortcode' => true,
206  'article' => array(
207  'id' => '54c67bb9e4b0512429885512',
208  'url' => 'https://docs.gravityview.co/article/66-configuring-delete-entry',
209  ),
210  ),
211  'user_duplicate' => array(
212  'label' => __( 'Allow User Duplicate', 'gravityview' ),
213  'group' => 'default',
214  'desc' => __( 'Allow logged-in users to duplicate entries they created.', 'gravityview' ) . ' ' . sprintf( __( 'Administrators are able to %s regardless of this setting.', 'gravityview' ), _x( 'duplicate entries', 'an action that admins can perform', 'gravityview' ) ),
215  'value' => 0,
216  'tooltip' => __( 'Display "Duplicate Entry" fields to non-administrator users if they created the entry. Duplicate Entry fields will always be displayed to site administrators.', 'gravityview' ),
217  'article' => array(
218  'id' => '5df11eb704286364bc92bf36',
219  'url' => 'https://docs.gravityview.co/article/66-configuring-delete-entry',
220  ),
221  'type' => 'checkbox',
222  'show_in_shortcode' => true,
223  ),
224  'sort_field' => array(
225  'label' => __( 'Sort by field', 'gravityview' ),
226  'type' => 'select',
227  'desc' => __( 'By default, entries are sorted by Entry ID.', 'gravityview' ),
228  'value' => '',
229  'group' => 'sort',
230  'options' => array(
231  '' => __( 'Default', 'gravityview' ),
232  'date_created' => __( 'Date Created', 'gravityview' ),
233  ),
234  'show_in_shortcode' => true,
235  'article' => array(
236  'id' => '54c67bbbe4b051242988551a',
237  'url' => 'https://docs.gravityview.co/article/74-sorting-results-by-field-value',
238  ),
239  ),
240  'sort_direction' => array(
241  'label' => __( 'Sort direction', 'gravityview' ),
242  'type' => 'select',
243  'value' => 'ASC',
244  'group' => 'sort',
245  'options' => array(
246  'ASC' => __( 'ASC', 'gravityview' ),
247  'DESC' => __( 'DESC', 'gravityview' ),
248  ),
249  'show_in_shortcode' => true,
250  'article' => array(
251  'id' => '5c9d338a2c7d3a1544617f9b',
252  'url' => 'https://docs.gravityview.co/article/570-sorting-by-multiple-columns',
253  ),
254  ),
255  'sort_field_2' => array(
256  'label' => __( 'Sort by secondary field', 'gravityview' ),
257  'type' => 'select',
258  'value' => '',
259  'group' => 'sort',
260  'options' => array(
261  '' => __( 'Default', 'gravityview' ),
262  'date_created' => __( 'Date Created', 'gravityview' ),
263  ),
264  'requires_not' => 'sort_direction][=RAND', // ][ is for toggleRequired, so it ends in []
265  'show_in_shortcode' => true,
266  'article' => array(
267  'id' => '5c9d338a2c7d3a1544617f9b',
268  'url' => 'https://docs.gravityview.co/article/570-sorting-by-multiple-columns',
269  ),
270  ),
271  'sort_direction_2' => array(
272  'label' => __( 'Secondary sort direction', 'gravityview' ),
273  'type' => 'select',
274  'value' => 'ASC',
275  'group' => 'sort',
276  'options' => array(
277  'ASC' => __( 'ASC', 'gravityview' ),
278  'DESC' => __( 'DESC', 'gravityview' ),
279  ),
280  'requires_not' => 'sort_direction][=RAND', // ][ is for toggleRequired, so it ends in []
281  'show_in_shortcode' => true,
282  'article' => array(
283  'id' => '5c9d338a2c7d3a1544617f9b',
284  'url' => 'https://docs.gravityview.co/article/570-sorting-by-multiple-columns',
285  ),
286  ),
287  'sort_columns' => array(
288  'label' => __( 'Enable sorting by column', 'gravityview' ),
289  'left_label' => __( 'Column Sorting', 'gravityview' ),
290  'type' => 'checkbox',
291  'value' => false,
292  'group' => 'sort',
293  'tooltip' => null,
294  'show_in_shortcode' => true,
295  'show_in_template' => array( 'default_table', 'preset_business_data', 'preset_issue_tracker', 'preset_resume_board', 'preset_job_board' ),
296  'article' => array(
297  'id' => '54ee1246e4b034c37ea91c11',
298  'url' => 'https://docs.gravityview.co/article/230-enabling-the-table-column-sorting-feature',
299  ),
300  ),
301  'start_date' => array(
302  'label' => __( 'Filter by Start Date', 'gravityview' ),
303  'class' => 'gv-datepicker',
304  'desc' => __( 'Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ),
305  'type' => 'text',
306  'value' => '',
307  'group' => 'filter',
308  'show_in_shortcode' => true,
309  'article' => array(
310  'id' => '54c67bbbe4b0512429885520',
311  'url' => 'https://docs.gravityview.co/article/79-using-relative-start-dates-and-end-dates',
312  ),
313  ),
314  'end_date' => array(
315  'label' => __( 'Filter by End Date', 'gravityview' ),
316  'class' => 'gv-datepicker',
317  'desc' => __( 'Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ),
318  'type' => 'text',
319  'value' => '',
320  'group' => 'filter',
321  'show_in_shortcode' => true,
322  'article' => array(
323  'id' => '54c67bbbe4b0512429885520',
324  'url' => 'https://docs.gravityview.co/article/79-using-relative-start-dates-and-end-dates',
325  ),
326  ),
327  'class' => array(
328  'label' => __( 'CSS Class', 'gravityview' ),
329  'desc' => __( 'CSS class to add to the wrapping HTML container.', 'gravityview' ),
330  'group' => 'default',
331  'type' => 'text',
332  'value' => '',
333  'show_in_shortcode' => false,
334  ),
335  'search_value' => array(
336  'label' => __( 'Search Value', 'gravityview' ),
337  'desc' => __( 'Define a default search value for the View', 'gravityview' ),
338  'type' => 'text',
339  'value' => '',
340  'group' => 'filter',
341  'show_in_shortcode' => false,
342  ),
343  'search_field' => array(
344  'label' => __( 'Search Field', 'gravityview' ),
345  'desc' => __( 'If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview' ),
346  'type' => 'text',
347  'value' => '',
348  'group' => 'filter',
349  'show_in_shortcode' => false,
350  ),
351  'search_operator' => array(
352  'label' => __( 'Search Operator', 'gravityview' ),
353  'type' => 'operator',
354  'value' => 'contains',
355  'group' => 'filter',
356  'show_in_shortcode' => false,
357  ),
358  'single_title' => array(
359  'label' => __( 'Single Entry Title', 'gravityview' ),
360  'type' => 'text',
361  'desc' => __( 'When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview' ),
362  'group' => 'default',
363  'value' => '',
364  'show_in_shortcode' => false,
365  'full_width' => true,
366  'article' => array(
367  'id' => '54c67bcee4b07997ea3f3f9a',
368  'url' => 'https://docs.gravityview.co/article/121-changing-the-single-entry-page-title',
369  ),
370  ),
371  'back_link_label' => array(
372  'label' => __( 'Back Link Label', 'gravityview' ),
373  'group' => 'default',
374  'desc' => __( 'The text of the link that returns to the multiple entries view.', 'gravityview' ),
375  'type' => 'text',
376  'value' => '',
377  'placeholder' => __( '&larr; Go back', 'gravityview' ),
378  'class' => 'widefat',
379  'merge_tags' => 'force',
380  'show_in_shortcode' => false,
381  'full_width' => true,
382  ),
383  'edit_redirect' => array(
384  'label' => __( 'Redirect After Editing', 'gravityview' ),
385  'group' => 'default',
386  'desc' => __( 'The page to redirect to after editing an entry.', 'gravityview' ),
387  'type' => 'select',
388  'value' => '',
389  'options' => array(
390  '' => __( 'Stay on Edit Entry', 'gravityview' ),
391  '0' => __( 'Redirect to Single Entry', 'gravityview' ),
392  '1' => __( 'Redirect to Multiple Entries', 'gravityview' ),
393  '2' => __( 'Redirect to URL', 'gravityview' ),
394  ),
395  'article' => array(
396  'id' => '5e9a3e0c2c7d3a7e9aeb2efb',
397  'url' => 'https://docs.gravityview.co/article/707-view-settings-redirect-after-editing',
398  ),
399  ),
400  'edit_return_context' => array(
401  'label' => __( 'Editing Returns To&hellip;', 'gravityview' ),
402  'type' => 'radio',
403  'desc' => __( 'After editing an entry or clicking Cancel, where should the user be sent?', 'gravityview' ),
404  'group' => 'default',
405  'value' => 'single',
406  'options' => array(
407  'multiple' => __( 'Multiple Entries', 'gravityview' ),
408  'single' => __( 'Single Entry', 'gravityview' ),
409  'custom' => __( 'Other URL', 'gravityview' ),
410  ),
411  'show_in_shortcode' => false,
412  'full_width' => true,
413  'article' => array(
414  'id' => '5e9a3e0c2c7d3a7e9aeb2efb',
415  'url' => 'https://docs.gravityview.co/article/707-view-settings-redirect-after-editing',
416  ),
417  ),
418  'edit_redirect_url' => array(
419  'label' => __( 'Edit Entry Redirect URL', 'gravityview' ),
420  'group' => 'default',
421  'desc' => __( 'After editing an entry, the user will be taken to this URL.', 'gravityview' ),
422  'type' => 'text',
423  'class' => 'code widefat',
424  'value' => '',
425  'placeholder' => 'https://www.example.com/landing-page/',
426  'requires' => 'edit_redirect=2',
427  'merge_tags' => 'force',
428  ),
429  'edit_locking' => array(
430  'label' => __( 'Enable Edit Locking', 'gravityview' ),
431  'group' => 'default',
432  'desc' => __( 'Prevent multiple users from editing the same entry at the same time.', 'gravityview' ),
433  'type' => 'checkbox',
434  'full_width' => true,
435  'class' => 'code widefat',
436  'value' => true,
437  'article' => array(
438  'id' => '5e4449d72c7d3a7e9ae7a54c',
439  'url' => 'https://docs.gravityview.co/article/676-entry-locking',
440  ),
441  ),
442  'delete_redirect' => array(
443  'label' => __( 'Redirect After Deleting', 'gravityview' ),
444  'group' => 'default',
445  'desc' => __( 'The page to redirect to after deleting an entry.', 'gravityview' ),
446  'type' => 'select',
447  'value' => '1',
448  'options' => array(
449  \GravityView_Delete_Entry::REDIRECT_TO_MULTIPLE_ENTRIES_VALUE => __( 'Redirect to Multiple Entries', 'gravityview' ),
450  \GravityView_Delete_Entry::REDIRECT_TO_URL_VALUE => __( 'Redirect to URL', 'gravityview' ),
451  ),
452  ),
453  'delete_redirect_url' => array(
454  'label' => __( 'Delete Entry Redirect URL', 'gravityview' ),
455  'group' => 'default',
456  'desc' => __( 'After deleting an entry, the user will be taken to this URL.', 'gravityview' ),
457  'type' => 'text',
458  'class' => 'code widefat',
459  'value' => '',
460  'placeholder' => 'https://www.example.com/landing-page/',
461  'requires' => 'delete_redirect=' . \GravityView_Delete_Entry::REDIRECT_TO_URL_VALUE,
462  'merge_tags' => 'force',
463  ),
464  'embed_only' => array(
465  'label' => __( 'Prevent Direct Access', 'gravityview' ),
466  'group' => 'default',
467  'desc' => __( 'Only allow access to this View when embedded using the shortcode.', 'gravityview' ),
468  'type' => 'checkbox',
469  'value' => '',
470  'tooltip' => false,
471  'show_in_shortcode' => false,
472  'full_width' => true,
473  ),
474  ),
475  ( gravityview()->plugin->supports( Plugin::FEATURE_REST ) && ( gravityview()->plugin->settings->get( 'rest_api' ) === '1' ) ) ?
476  array(
477  'rest_disable' => array(
478  'label' => __( 'Prevent REST Access', 'gravityview' ),
479  'group' => 'default',
480  'desc' => __( 'Disable REST access to this View.', 'gravityview' ),
481  'type' => 'checkbox',
482  'value' => '',
483  'tooltip' => false,
484  'show_in_shortcode' => false,
485  'full_width' => true,
486  ),
487  ) : array(),
488  ( gravityview()->plugin->supports( Plugin::FEATURE_REST ) && ( gravityview()->plugin->settings->get( 'rest_api' ) !== '1' ) ) ?
489  array(
490  'rest_enable' => array(
491  'label' => __( 'Allow REST Access', 'gravityview' ),
492  'group' => 'default',
493  'desc' => __( 'Enable REST access to this View.', 'gravityview' ),
494  'type' => 'checkbox',
495  'value' => '',
496  'tooltip' => false,
497  'show_in_shortcode' => false,
498  'full_width' => true,
499  ),
500  ) : array(),
501  array(
502  'csv_enable' => array(
503  'label' => __( 'Allow Export', 'gravityview' ),
504  'group' => 'default',
505  'desc' => __( 'Enable users to download data as a CSV or TSV file.', 'gravityview' ),
506  'type' => 'checkbox',
507  'value' => '',
508  'tooltip' => __( 'If enabled, entries can be exported for this View by adding "/csv/" or "/tsv/" to the View URL. Each configured field will be a column in the exported file.', 'gravityview' ),
509  'show_in_shortcode' => false,
510  'full_width' => true,
511  'article' => array(
512  'id' => '5bad2a0c042863158cc6d4ac',
513  'url' => 'https://docs.gravityview.co/article/491-csv-export',
514  ),
515  ),
516  ),
517  array(
518  'csv_nolimit' => array(
519  'label' => __( 'Show all in file', 'gravityview' ),
520  'group' => 'default',
521  'desc' => __( 'Do not limit the number of entries output in the file.', 'gravityview' ),
522  'type' => 'checkbox',
523  'value' => '',
524  'tooltip' => false,
525  'show_in_shortcode' => false,
526  'full_width' => true,
527  'requires' => 'csv_enable=1',
528  ),
529  ),
530  array(
531  'post_id' => array(
532  'type' => 'number',
533  'value' => '',
534  'show_in_shortcode' => false,
535  ),
536  )
537  );
538 
539  if ( version_compare( \GFCommon::$version, '2.3-beta-4', '>=' ) ) {
540  $default_settings['sort_direction']['options']['RAND'] = __( 'Random', 'gravityview' );
541  }
542 
543  /**
544  * @filter `gravityview_default_args` Modify the default settings for new Views
545  * @param[in,out] array $default_args Array of default args.
546  * @deprecated
547  * @see filter `gravityview/view/settings/defaults`
548  */
549  $default_settings = apply_filters( 'gravityview_default_args', $default_settings );
550 
551  /**
552  * @filter `gravityview/view/defaults` Modify the default settings for new Views
553  * @param[in,out] array $default_settings Array of default settings.
554  */
555  $default_settings = apply_filters( 'gravityview/view/settings/defaults', $default_settings );
556 
557  // By default, we only want the key => value pairing, not the whole array.
558  if ( ! $detailed ) {
559  $defaults = array();
560  foreach ( $default_settings as $key => $value ) {
561  $defaults[ $key ] = $value['value'];
562  }
563  return $defaults;
564 
565  // But sometimes, we want all the details.
566  } else {
567  foreach ( $default_settings as $key => $value ) {
568 
569  // If the $group argument is set for the method,
570  // ignore any settings that aren't in that group.
571  if ( ! empty( $group ) && is_string( $group ) ) {
572  if ( empty( $value['group'] ) || $value['group'] !== $group ) {
573  unset( $default_settings[ $key ] );
574  }
575  }
576  }
577  return $default_settings;
578  }
579  }
580 
581  /**
582  * Turn to an $atts array as used around the old codebase.
583  *
584  * @internal
585  * @deprecated
586  *
587  * @return array
588  */
589  public function as_atts() {
590  $defaults = array_keys( self::defaults() );
591  $_this = &$this;
592  return array_combine(
593  $defaults,
594  array_map(
595  function( $key ) use ( $_this ) {
596  return $_this->get( $key );
597  },
598  $defaults
599  )
600  );
601  }
602 }
If this file is called directly, abort.
static with_defaults( $detailed=false)
Retrieve an instance of the settings with default values.
gravityview()
Definition: _stubs.php:26
If this file is called directly, abort.
defaults()
Default settings.
if(empty( $field_settings['email_field'])) $settings
const REDIRECT_TO_URL_VALUE
The value of the delete_redirect option when the setting is to redirect to URL.
as_atts()
Turn to an $atts array as used around the old codebase.
static defaults( $detailed=false, $group=null)
Retrieve the default View settings.
const REDIRECT_TO_MULTIPLE_ENTRIES_VALUE
The value of the delete_redirect option when the setting is to redirect to Multiple Entries after del...