5 if ( ! defined(
'GRAVITYVIEW_DIR' ) ) {
25 $settings->update( self::defaults( $detailed ) );
48 public static function defaults( $detailed =
false, $group = null ) {
50 $default_settings = array_merge(
53 'label' => __(
'View ID',
'gk-gravityview' ),
58 'show_in_shortcode' =>
false,
61 'label' => __(
'Number of entries per page',
'gk-gravityview' ),
63 'class' =>
'small-text',
66 'show_in_shortcode' =>
true,
69 'label' => __(
'Offset entries starting from',
'gk-gravityview' ),
71 'class' =>
'small-text',
74 'show_in_shortcode' =>
true,
77 'label' => __(
'Enable lightbox for images',
'gk-gravityview' ),
81 '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.',
'gk-gravityview' ),
82 'show_in_shortcode' =>
true,
84 'id' =>
'5e9a1f8904286364bc98931f',
85 'url' =>
'https://docs.gravityview.co/article/705-view-settings-enable-lightbox-for-images',
88 'show_only_approved' => array(
89 'label' => __(
'Show only approved entries',
'gk-gravityview' ),
92 '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.',
'gk-gravityview' ),
95 'show_in_shortcode' =>
true,
97 'id' =>
'5bad1a33042863158cc6d396',
98 'url' =>
'https://docs.gravityview.co/article/490-entry-approval-gravity-forms',
101 'no_entries_options' => array(
102 'label' => __(
'No Entries Behavior',
'gk-gravityview' ),
104 'desc' => __(
'Choose what happens when a View has no entries visible to the current user.',
'gk-gravityview' ),
105 'group' =>
'default',
107 '0' => __(
'Show a Message',
'gk-gravityview' ),
108 '1' => __(
'Display a Form',
'gk-gravityview' ),
109 '2' => __(
'Redirect to URL',
'gk-gravityview' ),
112 'show_in_shortcode' =>
true,
114 'no_results_text' => array(
115 'label' => __(
'No Entries Message',
'gk-gravityview' ),
117 'group' =>
'default',
118 'desc' => esc_html__(
'The text to display when there are no entries to show. HTML and shortcodes are allowed.',
'gk-gravityview' ),
121 'placeholder' => esc_html__(
'No entries match your request.',
'gk-gravityview' ),
122 'show_in_shortcode' =>
true,
123 'class' =>
'widefat',
124 'requires' =>
'no_entries_options=0',
125 'full_width' =>
true,
127 'no_entries_form' => array(
128 'label' => __(
'No Entries Form',
'gk-gravityview' ),
130 'desc' => __(
'Show a Gravity Forms form if there are no entries to show in the View.',
'gk-gravityview' ),
131 'group' =>
'default',
132 'requires' =>
'no_entries_options=1',
134 'value' => esc_attr( \
GV\Utils::_POST(
'post' ) ?
gravityview_get_form_id( \
GV\Utils::_POST(
'post' ) ) : \
GV\Utils::_GET(
'form_id',
'' ) ),
135 'show_in_shortcode' =>
true,
137 'no_entries_form_title' => array(
138 'label' => __(
'Form Title',
'gk-gravityview' ),
139 'type' =>
'checkbox',
140 'group' =>
'default',
141 'requires' =>
'no_entries_options=1',
143 'show_in_shortcode' =>
true,
145 'no_entries_form_description' => array(
146 'label' => __(
'Form Description',
'gk-gravityview' ),
147 'type' =>
'checkbox',
148 'group' =>
'default',
149 'requires' =>
'no_entries_options=1',
151 'show_in_shortcode' =>
true,
153 'no_entries_redirect' => array(
154 'label' => __(
'No Entries Redirect URL',
'gk-gravityview' ),
155 'group' =>
'default',
156 'desc' => __(
'If there are no entries to show, the user will be taken to this URL.',
'gk-gravityview' ),
158 'class' =>
'code widefat',
160 'placeholder' =>
'https://www.example.com',
161 'requires' =>
'no_entries_options=2',
163 'no_search_results_text' => array(
164 'label' => __(
'"No Search Results" Text',
'gk-gravityview' ),
166 'group' =>
'default',
170 'placeholder' => __(
'This search returned no results.',
'gk-gravityview' ),
171 'show_in_shortcode' =>
true,
172 'class' =>
'widefat',
173 'full_width' =>
true,
175 'admin_show_all_statuses' => array(
176 'label' => __(
'Show all entries to administrators',
'gk-gravityview' ),
177 'desc' => __(
'Administrators will be able to see entries with any approval status.',
'gk-gravityview' ),
178 '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.',
'gk-gravityview' ),
179 'requires' =>
'show_only_approved',
180 'type' =>
'checkbox',
181 'group' =>
'default',
183 'show_in_shortcode' =>
false,
185 'hide_until_searched' => array(
186 'label' => __(
'Hide View data until search is performed',
'gk-gravityview' ),
187 'type' =>
'checkbox',
188 'group' =>
'default',
189 'tooltip' => __(
'When enabled it will only show any View entries after a search is performed.',
'gk-gravityview' ),
191 'show_in_shortcode' =>
false,
193 'id' =>
'5c772fa02c7d3a0cb9320a84',
194 'url' =>
'https://docs.gravityview.co/article/536-how-to-hide-results-and-only-display-them-if-a-search-is-performed',
197 'hide_empty' => array(
198 'label' => __(
'Hide empty fields',
'gk-gravityview' ),
199 'group' =>
'default',
200 'type' =>
'checkbox',
201 'desc' => __(
'When enabled, empty fields will be not be displayed. If disabled, fields and their labels will be displayed with no content.',
'gk-gravityview' ),
204 'show_in_shortcode' =>
false,
206 'hide_empty_single' => array(
207 'label' => __(
'Hide empty fields',
'gk-gravityview' ),
208 'group' =>
'default',
209 'type' =>
'checkbox',
210 'desc' => __(
'When enabled, empty fields will be not be displayed. If disabled, fields and their labels will be displayed with no content.',
'gk-gravityview' ),
213 'show_in_shortcode' =>
false,
215 'edit_feeds' => array(
216 'label' => __(
'Feeds',
'gk-gravityview' ),
217 'group' =>
'default',
218 'type' =>
'checkbox',
220 'show_in_shortcode' =>
false,
222 'user_edit' => array(
223 'label' => __(
'Allow User Edit',
'gk-gravityview' ),
224 'group' =>
'default',
225 'desc' => __(
'Allow logged-in users to edit entries they created.',
'gk-gravityview' ) .
' ' . sprintf( __(
'Administrators are able to %s regardless of this setting.',
'gk-gravityview' ), _x(
'edit entries',
'an action that admins can perform',
'gk-gravityview' ) ),
227 'tooltip' => __(
'Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.',
'gk-gravityview' ),
228 'type' =>
'checkbox',
229 'show_in_shortcode' =>
true,
231 'id' =>
'54c67bbbe4b07997ea3f3f6b',
232 'url' =>
'https://docs.gravityview.co/article/77-user-edit-allow-users-to-edit-their-own-entries',
235 'unapprove_edit' => array(
236 'label' => __(
'Unapprove Entries After Edit',
'gk-gravityview' ),
237 'group' =>
'default',
238 'requires' =>
'user_edit',
239 'desc' => __(
'When an entry is edited by a non-administrator, reset the approval status to "Unapproved".',
'gk-gravityview' ),
240 '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.',
'gk-gravityview' ),
242 'type' =>
'checkbox',
243 'show_in_shortcode' =>
true,
245 'id' =>
'5ddd81d504286364bc923957',
246 'url' =>
'https://docs.gravityview.co/article/657-unapproving-edited-entries-automatically',
249 'user_delete' => array(
250 'label' => __(
'Allow User Delete',
'gk-gravityview' ),
251 'group' =>
'default',
252 'desc' => __(
'Allow logged-in users to delete entries they created.',
'gk-gravityview' ) .
' ' . sprintf( __(
'Administrators are able to %s regardless of this setting.',
'gk-gravityview' ), _x(
'delete entries',
'an action that admins can perform',
'gk-gravityview' ) ),
254 'tooltip' => __(
'Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.',
'gk-gravityview' ),
255 'type' =>
'checkbox',
256 'show_in_shortcode' =>
true,
258 'id' =>
'54c67bb9e4b0512429885512',
259 'url' =>
'https://docs.gravityview.co/article/66-configuring-delete-entry',
262 'user_duplicate' => array(
263 'label' => __(
'Allow User Duplicate',
'gk-gravityview' ),
264 'group' =>
'default',
265 'desc' => __(
'Allow logged-in users to duplicate entries they created.',
'gk-gravityview' ) .
' ' . sprintf( __(
'Administrators are able to %s regardless of this setting.',
'gk-gravityview' ), _x(
'duplicate entries',
'an action that admins can perform',
'gk-gravityview' ) ),
267 'tooltip' => __(
'Display "Duplicate Entry" fields to non-administrator users if they created the entry. Duplicate Entry fields will always be displayed to site administrators.',
'gk-gravityview' ),
269 'id' =>
'5df11eb704286364bc92bf36',
270 'url' =>
'https://docs.gravityview.co/article/66-configuring-delete-entry',
272 'type' =>
'checkbox',
273 'show_in_shortcode' =>
true,
275 'sort_field' => array(
276 'label' => __(
'Sort by field',
'gk-gravityview' ),
278 'desc' => __(
'By default, entries are sorted by Entry ID.',
'gk-gravityview' ),
282 '' => __(
'Default',
'gk-gravityview' ),
283 'date_created' => __(
'Date Created',
'gk-gravityview' ),
285 'show_in_shortcode' =>
true,
287 'id' =>
'54c67bbbe4b051242988551a',
288 'url' =>
'https://docs.gravityview.co/article/74-sorting-results-by-field-value',
291 'sort_direction' => array(
292 'label' => __(
'Sort direction',
'gk-gravityview' ),
297 'ASC' => __(
'ASC',
'gk-gravityview' ),
298 'DESC' => __(
'DESC',
'gk-gravityview' ),
299 'RAND' => __(
'Random',
'gk-gravityview' ),
301 'show_in_shortcode' =>
true,
303 'id' =>
'5c9d338a2c7d3a1544617f9b',
304 'url' =>
'https://docs.gravityview.co/article/570-sorting-by-multiple-columns',
307 'sort_field_2' => array(
308 'label' => __(
'Sort by secondary field',
'gk-gravityview' ),
313 '' => __(
'Default',
'gk-gravityview' ),
314 'date_created' => __(
'Date Created',
'gk-gravityview' ),
316 'requires_not' =>
'sort_direction][=RAND',
317 'show_in_shortcode' =>
true,
319 'id' =>
'5c9d338a2c7d3a1544617f9b',
320 'url' =>
'https://docs.gravityview.co/article/570-sorting-by-multiple-columns',
323 'sort_direction_2' => array(
324 'label' => __(
'Secondary sort direction',
'gk-gravityview' ),
329 'ASC' => __(
'ASC',
'gk-gravityview' ),
330 'DESC' => __(
'DESC',
'gk-gravityview' ),
332 'requires_not' =>
'sort_direction][=RAND',
333 'show_in_shortcode' =>
true,
335 'id' =>
'5c9d338a2c7d3a1544617f9b',
336 'url' =>
'https://docs.gravityview.co/article/570-sorting-by-multiple-columns',
339 'sort_columns' => array(
340 'label' => __(
'Enable sorting by column',
'gk-gravityview' ),
341 'left_label' => __(
'Column Sorting',
'gk-gravityview' ),
342 'type' =>
'checkbox',
346 'show_in_shortcode' =>
true,
347 'show_in_template' => array(
349 'preset_business_data',
350 'preset_issue_tracker',
351 'preset_resume_board',
355 'id' =>
'54ee1246e4b034c37ea91c11',
356 'url' =>
'https://docs.gravityview.co/article/230-enabling-the-table-column-sorting-feature',
359 'start_date' => array(
360 'label' => __(
'Filter by Start Date',
'gk-gravityview' ),
361 'class' =>
'gv-datepicker',
362 'desc' => __(
'Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".',
'gk-gravityview' ),
366 'show_in_shortcode' =>
true,
368 'id' =>
'54c67bbbe4b0512429885520',
369 'url' =>
'https://docs.gravityview.co/article/79-using-relative-start-dates-and-end-dates',
373 'label' => __(
'Filter by End Date',
'gk-gravityview' ),
374 'class' =>
'gv-datepicker',
375 'desc' => __(
'Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".',
'gk-gravityview' ),
379 'show_in_shortcode' =>
true,
381 'id' =>
'54c67bbbe4b0512429885520',
382 'url' =>
'https://docs.gravityview.co/article/79-using-relative-start-dates-and-end-dates',
386 'label' => __(
'CSS Class',
'gk-gravityview' ),
387 'desc' => __(
'CSS class to add to the wrapping HTML container.',
'gk-gravityview' ),
388 'group' =>
'default',
391 'show_in_shortcode' =>
false,
393 'search_value' => array(
394 'label' => __(
'Search Value',
'gk-gravityview' ),
395 'desc' => __(
'Define a default search value for the View',
'gk-gravityview' ),
399 'show_in_shortcode' =>
false,
401 'search_field' => array(
402 'label' => __(
'Search Field',
'gk-gravityview' ),
403 'desc' => __(
'If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.',
'gk-gravityview' ),
407 'show_in_shortcode' =>
false,
409 'search_operator' => array(
410 'label' => __(
'Search Operator',
'gk-gravityview' ),
411 'type' =>
'operator',
412 'value' =>
'contains',
414 'show_in_shortcode' =>
false,
416 'single_title' => array(
417 'label' => __(
'Single Entry Title',
'gk-gravityview' ),
419 '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.',
'gk-gravityview' ),
420 'group' =>
'default',
422 'show_in_shortcode' =>
false,
423 'full_width' =>
true,
425 'id' =>
'54c67bcee4b07997ea3f3f9a',
426 'url' =>
'https://docs.gravityview.co/article/121-changing-the-single-entry-page-title',
429 'back_link_label' => array(
430 'label' => __(
'Back Link Label',
'gk-gravityview' ),
431 'group' =>
'default',
432 'desc' => __(
'The text of the link that returns to the multiple entries view.',
'gk-gravityview' ),
435 'placeholder' => __(
'← Go back',
'gk-gravityview' ),
436 'class' =>
'widefat',
437 'merge_tags' =>
'force',
438 'show_in_shortcode' =>
false,
439 'full_width' =>
true,
441 'edit_redirect' => array(
442 'label' => __(
'Redirect After Editing',
'gk-gravityview' ),
443 'group' =>
'default',
444 'desc' => __(
'The page to redirect to after editing an entry.',
'gk-gravityview' ),
448 '' => __(
'Stay on Edit Entry',
'gk-gravityview' ),
449 '0' => __(
'Redirect to Single Entry',
'gk-gravityview' ),
450 '1' => __(
'Redirect to Multiple Entries',
'gk-gravityview' ),
451 '2' => __(
'Redirect to URL',
'gk-gravityview' ),
454 'id' =>
'5e9a3e0c2c7d3a7e9aeb2efb',
455 'url' =>
'https://docs.gravityview.co/article/707-view-settings-redirect-after-editing',
458 'edit_return_context' => array(
459 'label' => __(
'Editing Returns To…',
'gk-gravityview' ),
461 'desc' => __(
'After editing an entry or clicking Cancel, where should the user be sent?',
'gk-gravityview' ),
462 'group' =>
'default',
465 'multiple' => __(
'Multiple Entries',
'gk-gravityview' ),
466 'single' => __(
'Single Entry',
'gk-gravityview' ),
467 'custom' => __(
'Other URL',
'gk-gravityview' ),
469 'show_in_shortcode' =>
false,
470 'full_width' =>
true,
472 'id' =>
'5e9a3e0c2c7d3a7e9aeb2efb',
473 'url' =>
'https://docs.gravityview.co/article/707-view-settings-redirect-after-editing',
476 'edit_redirect_url' => array(
477 'label' => __(
'Edit Entry Redirect URL',
'gk-gravityview' ),
478 'group' =>
'default',
479 'desc' => __(
'After editing an entry, the user will be taken to this URL.',
'gk-gravityview' ),
481 'class' =>
'code widefat',
483 'placeholder' =>
'https://www.example.com/landing-page/',
484 'requires' =>
'edit_redirect=2',
485 'merge_tags' =>
'force',
487 'action_label_update' => array(
488 'label' => __(
'Update Button Text',
'gk-gravityview' ),
489 'group' =>
'default',
492 'value' => _x(
'Update',
'Button to update an entry the user is editing',
'gk-gravityview' ),
493 'merge_tags' =>
'force',
495 'action_label_cancel' => array(
496 'label' => __(
'Cancel Link Text',
'gk-gravityview' ),
497 'group' =>
'default',
500 'value' => _x(
'Cancel',
'Shown when the user decides not to edit an entry',
'gk-gravityview' ),
501 'merge_tags' =>
'force',
503 'action_label_next' => array(
504 'label' => __(
'Next Page Button Text',
'gk-gravityview' ),
505 'group' =>
'default',
506 'desc' => __(
'Only shown when multi-page forms are enabled.',
'gk-gravityview' ),
508 'value' => __(
'Next',
'Show the next page in a multi-page form',
'gk-gravityview' ),
509 'merge_tags' =>
'force',
511 'action_label_previous' => array(
512 'label' => __(
'Previous Page Button Text',
'gk-gravityview' ),
513 'group' =>
'default',
514 'desc' => __(
'Only shown when multi-page forms are enabled.',
'gk-gravityview' ),
516 'value' => __(
'Previous',
'Show the previous page in a multi-page form',
'gk-gravityview' ),
517 'merge_tags' =>
'force',
519 'action_label_delete' => array(
520 'label' => __(
'Delete Link Text',
'gk-gravityview' ),
521 'group' =>
'default',
524 'value' => __(
'Delete',
'Button label to delete an entry from the Edit Entry screen',
'gk-gravityview' ),
525 'merge_tags' =>
'force',
527 'edit_locking' => array(
528 'label' => __(
'Enable Edit Locking',
'gk-gravityview' ),
529 'group' =>
'default',
530 'desc' => __(
'Prevent multiple users from editing the same entry at the same time.',
'gk-gravityview' ),
531 'type' =>
'checkbox',
532 'full_width' =>
true,
533 'class' =>
'code widefat',
536 'id' =>
'5e4449d72c7d3a7e9ae7a54c',
537 'url' =>
'https://docs.gravityview.co/article/676-entry-locking',
540 'delete_redirect' => array(
541 'label' => __(
'Redirect After Deleting',
'gk-gravityview' ),
542 'group' =>
'default',
543 'desc' => __(
'The page to redirect to after deleting an entry.',
'gk-gravityview' ),
551 'delete_redirect_url' => array(
552 'label' => __(
'Delete Entry Redirect URL',
'gk-gravityview' ),
553 'group' =>
'default',
554 'desc' => __(
'After deleting an entry, the user will be taken to this URL.',
'gk-gravityview' ),
556 'class' =>
'code widefat',
558 'placeholder' =>
'https://www.example.com/landing-page/',
560 'merge_tags' =>
'force',
562 'embed_only' => array(
563 'label' => __(
'Prevent Direct Access',
'gk-gravityview' ),
564 'group' =>
'default',
565 'desc' => __(
'Only allow access to this View when embedded using the shortcode.',
'gk-gravityview' ),
566 'type' =>
'checkbox',
569 'show_in_shortcode' =>
false,
570 'full_width' =>
true,
573 (
gravityview()->plugin->supports( Plugin::FEATURE_REST ) && (
gravityview()->plugin->settings->get(
'rest_api' ) ) ) ?
575 'rest_disable' => array(
576 'label' => __(
'Prevent REST Access',
'gk-gravityview' ),
577 'group' =>
'default',
578 'desc' => __(
'Disable REST access to this View.',
'gk-gravityview' ),
579 'type' =>
'checkbox',
582 'show_in_shortcode' =>
false,
583 'full_width' =>
true,
586 (
gravityview()->plugin->supports( Plugin::FEATURE_REST ) && ( !
gravityview()->plugin->settings->get(
'rest_api' ) ) ) ?
588 'rest_enable' => array(
589 'label' => __(
'Allow REST Access',
'gk-gravityview' ),
590 'group' =>
'default',
591 'desc' => __(
'Enable REST access to this View.',
'gk-gravityview' ),
592 'type' =>
'checkbox',
595 'show_in_shortcode' =>
false,
596 'full_width' =>
true,
600 'csv_enable' => array(
601 'label' => __(
'Allow Export',
'gk-gravityview' ),
602 'group' =>
'default',
603 'desc' => __(
'Enable users to download data as a CSV or TSV file.',
'gk-gravityview' ),
604 'type' =>
'checkbox',
606 '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.',
'gk-gravityview' ),
607 'show_in_shortcode' =>
false,
608 'full_width' =>
true,
610 'id' =>
'5bad2a0c042863158cc6d4ac',
611 'url' =>
'https://docs.gravityview.co/article/491-csv-export',
616 'csv_nolimit' => array(
617 'label' => __(
'Show all in file',
'gk-gravityview' ),
618 'group' =>
'default',
619 'desc' => __(
'Do not limit the number of entries output in the file.',
'gk-gravityview' ),
620 'type' =>
'checkbox',
623 'show_in_shortcode' =>
false,
624 'full_width' =>
true,
625 'requires' =>
'csv_enable=1',
632 'show_in_shortcode' =>
false,
644 $default_settings = apply_filters(
'gravityview_default_args', $default_settings );
651 $default_settings = apply_filters(
'gravityview/view/settings/defaults', $default_settings );
656 foreach ( $default_settings as $key =>
$value ) {
657 $defaults[ $key ] =
$value[
'value'];
664 foreach ( $default_settings as $key =>
$value ) {
668 if ( ! empty( $group ) && is_string( $group ) ) {
669 if ( empty(
$value[
'group'] ) ||
$value[
'group'] !== $group ) {
670 unset( $default_settings[ $key ] );
675 return $default_settings;
688 $defaults = array_keys( self::defaults() );
690 return array_combine(
693 function( $key ) use ( $_this ) {
694 return $_this->get( $key );
If this file is called directly, abort.
static with_defaults( $detailed=false)
Retrieve an instance of the settings with default values.
static get_forms_as_options( $active=true, $trash=false, $sort_column='id', $sort_dir='ASC')
Get all forms to use as options in View settings.
If this file is called directly, abort.
gravityview_get_form_id( $view_id)
Get the connected form ID from a View ID.
const REDIRECT_TO_URL_VALUE
The value of the delete_redirect option when the setting is to redirect to URL.
gravityview()
The main GravityView wrapper function.
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...