15 if ( ! defined(
'ABSPATH' ) ) {
24 add_action(
'save_post', array( $this,
'save_postdata' ) );
27 add_filter(
'gravityview_blocklist_field_types', array( $this,
'default_field_blocklist' ), 10, 2 );
30 add_filter(
'gform_tooltips', array( $this,
'tooltips') );
32 add_filter(
'admin_body_class', array( $this,
'add_gf_version_css_class' ) );
35 add_action(
'admin_enqueue_scripts', array(
'GravityView_Admin_Views',
'add_scripts_and_styles'), 999 );
36 add_filter(
'gform_noconflict_styles', array( $this,
'register_no_conflict') );
37 add_filter(
'gform_noconflict_scripts', array( $this,
'register_no_conflict') );
38 add_filter(
'gravityview_noconflict_styles', array( $this,
'register_no_conflict') );
39 add_filter(
'gravityview_noconflict_scripts', array( $this,
'register_no_conflict') );
41 add_action(
'gravityview_render_directory_active_areas', array( $this,
'render_directory_active_areas'), 10, 5 );
42 add_action(
'gravityview_render_widgets_active_areas', array( $this,
'render_widgets_active_areas'), 10, 3 );
43 add_action(
'gravityview_render_field_pickers', array( $this,
'render_field_pickers'), 10, 2 );
44 add_action(
'gravityview_render_available_fields', array( $this,
'render_available_fields'), 10, 2 );
45 add_action(
'gravityview_render_available_widgets', array( $this,
'render_available_widgets') );
46 add_action(
'gravityview_render_active_areas', array( $this,
'render_active_areas'), 10, 5 );
47 add_filter(
'gravityview/view/configuration/fields', array( $this,
'set_default_view_fields'), 10, 3 );
53 add_filter(
'manage_gravityview_posts_columns' , array( $this,
'add_post_type_columns' ) );
55 add_filter(
'gform_toolbar_menu', array(
'GravityView_Admin_Views',
'gform_toolbar_menu' ), 10, 2 );
56 add_action(
'gform_form_actions', array(
'GravityView_Admin_Views',
'gform_toolbar_menu' ), 10, 2 );
58 add_action(
'manage_gravityview_posts_custom_column', array( $this,
'add_custom_column_content'), 10, 2 );
60 add_action(
'restrict_manage_posts', array( $this,
'add_view_dropdown' ) );
62 add_action(
'pre_get_posts', array( $this,
'filter_pre_get_posts' ) );
64 add_filter(
'gravityview/support_port/localization_data', array( $this,
'suggest_support_articles' ) );
81 if ( ! class_exists(
'GFForms' ) || empty( GFForms::$version ) ) {
85 $class .=
' gf-version-' . str_replace(
'.',
'-', GFForms::$version );
87 $major_version = explode(
'.', GFForms::$version );
89 if ( 2 <=
sizeof( $major_version ) ) {
90 $class .=
' gf-minor-version-' . esc_attr( $major_version[0] .
'-' . $major_version[1] );
106 return $localization_data;
109 $localization_data[
'suggest'] = array(
110 '57ef23539033602e61d4a560',
111 '54c67bb9e4b0512429885513',
112 '54c67bb9e4b0512429885512',
113 '54c67bbbe4b07997ea3f3f6b',
114 '54d1a33ae4b086c0c0964ce9',
115 '57ef253c9033602e61d4a563',
116 '552355bfe4b0221aadf2572b',
117 '54c67bcde4b051242988553e',
120 return $localization_data;
130 if ( ! is_admin() ) {
134 if (
'edit.php' !== $pagenow ) {
138 if ( ! isset( $query->query_vars[
'post_type'] ) ) {
142 if (
'gravityview' !== $query->query_vars[
'post_type'] ) {
146 $form_id = (int) \
GV\Utils::_GET(
'gravityview_form_id' );
148 $meta_query = array();
151 $meta_query[] = array(
152 'key' =>
'_gravityview_form_id',
160 $meta_query[] = array(
161 'key' =>
'_gravityview_directory_template',
162 'value' => esc_attr( $layout_id ),
166 $query->set(
'meta_query', $meta_query );
175 $current_screen = get_current_screen();
177 if(
'gravityview' !== $current_screen->post_type ) {
185 if( ! empty(
$forms ) ) { ?>
186 <label
for=
"gravityview_form_id" class=
"screen-reader-text"><?php esc_html_e(
'Filter Views by form',
'gk-gravityview' ); ?></label>
187 <select name=
"gravityview_form_id" id=
"gravityview_form_id">
188 <option value=
"" <?php selected(
'',
$current_form,
true ); ?>><?php esc_html_e(
'All forms',
'gk-gravityview' ); ?></option>
190 <option value=
"<?php echo esc_attr( $form['id'] ); ?>" <?php selected( $form[
'id'],
$current_form,
true ); ?>><?php echo esc_html( $form[
'title'] ); ?></option>
199 if( ! empty( $layouts ) ) { ?>
200 <label
for=
"gravityview_layout_name" class=
"screen-reader-text"><?php esc_html_e(
'Filter Views by layout',
'gk-gravityview' ); ?></label>
201 <select name=
"gravityview_layout" id=
"gravityview_layout_name">
202 <option value=
"" <?php selected(
'', $current_layout,
true ); ?>><?php esc_html_e(
'All layouts',
'gk-gravityview' ); ?></option>
203 <optgroup label=
"<?php esc_html_e( 'Layouts', 'gk-gravityview' ); ?>">
204 <?php
foreach( $layouts as $layout_id => $layout ) {
205 if ( in_array( $layout[
'type'], array(
'preset',
'internal' ),
true ) ) {
209 <option value=
"<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout,
true ); ?>><?php echo esc_html( $layout[
'label'] ); ?></option>
212 <optgroup label=
"<?php esc_html_e( 'Form Presets', 'gk-gravityview' ); ?>">
213 <?php
foreach( $layouts as $layout_id => $layout ) {
214 if ( ! in_array( $layout[
'type'], array(
'preset' ),
true ) ) {
218 <option value=
"<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout,
true ); ?>><?php echo esc_html( $layout[
'label'] ); ?></option>
231 _deprecated_function(
'GravityView_Admin_Views::render_setting_row',
'1.1.7',
'GravityView_Render_Settings::render_setting_row' );
240 _deprecated_function(
'GravityView_Admin_Views::render_field_option',
'1.1.7',
'GravityView_Render_Settings::render_field_option' );
254 if (
'trash' === rgget(
'filter' ) ) {
262 if(
'form_list' === GFForms::get_page() ) {
266 if( empty( $connected_views ) ) {
268 $menu_items[
'gravityview'] = array(
269 'label' => esc_attr__(
'Create a View',
'gk-gravityview' ),
270 'icon' =>
'<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
271 'title' => esc_attr__(
'Create a View using this form as a data source',
'gk-gravityview' ),
272 'url' => admin_url(
'post-new.php?post_type=gravityview&form_id=' . $id ),
273 'menu_class' =>
'gv_connected_forms gf_form_toolbar_settings',
274 'priority' => $priority,
275 'capabilities' => array(
'edit_gravityviews' ),
281 $sub_menu_items = array();
282 foreach ( (array)$connected_views as $view ) {
288 $label = empty( $view->post_title ) ? sprintf( __(
'No Title (View #%d)',
'gk-gravityview' ), $view->ID ) : $view->post_title;
290 $sub_menu_items[] = array(
291 'label' => esc_attr(
$label ),
292 'url' => admin_url(
'post.php?action=edit&post='.$view->ID ),
293 'icon' =>
'<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
298 if( $sub_menu_items ) {
300 $sub_menu_items[] = array(
301 'label' => esc_attr__(
'Create a View',
'gk-gravityview' ),
302 'icon' =>
'<span class="dashicons dashicons-plus"></span>',
303 'title' => esc_attr__(
'Create a View using this form as a data source',
'gk-gravityview' ),
304 'url' => admin_url(
'post-new.php?post_type=gravityview&form_id=' . $id ),
305 'capabilities' => array(
'edit_gravityviews' ),
309 $sub_menu_items[] = array(
312 'menu_class' =>
'hidden',
313 'capabilities' =>
'',
316 $menu_items[
'gravityview'] = array(
317 'label' => __(
'Connected Views',
'gk-gravityview' ),
318 'icon' =>
'<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
319 'title' => __(
'GravityView Views using this form as a data source',
'gk-gravityview' ),
321 'onclick' =>
'return false;',
322 'menu_class' =>
'gv_connected_forms gf_form_toolbar_settings',
323 'sub_menu_items' => $sub_menu_items,
324 'priority' => $priority,
325 'capabilities' => array(
'edit_gravityviews' ),
344 $add = array(
'captcha',
'page' );
347 if( $context ===
'edit' ) {
351 $return = array_merge( $array, $add );
360 _deprecated_function( __METHOD__,
'2.14',
'GravityView_Admin_Views::default_field_blocklist' );
371 $gv_tooltips = array();
376 foreach ( $default_args as $key => $arg ) {
379 if( isset( $arg[
'tooltip'] ) && empty( $arg[
'tooltip'] ) ) {
continue; }
382 $tooltip = empty( $arg[
'tooltip'] ) ? NULL : $arg[
'tooltip'];
385 if( empty( $tooltip ) ) {
390 $gv_tooltips[
'gv_'.$key ] = array(
391 'title' => $arg[
'label'],
397 $gv_tooltips[
'gv_css_merge_tags'] = array(
398 'title' => __(
'CSS Merge Tags',
'gk-gravityview'),
399 'value' => sprintf( __(
'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.',
'gk-gravityview'),
'<code>',
'</code>' )
407 $gv_tooltips = apply_filters(
'gravityview_tooltips', $gv_tooltips );
413 $gv_tooltips = apply_filters(
'gravityview/metaboxes/tooltips', $gv_tooltips );
415 foreach ( $gv_tooltips as $key => $tooltip ) {
417 $title = empty( $tooltip[
'title'] ) ?
'' :
'<h6>'.esc_html( $tooltip[
'title'] ) .
'</h6>';
419 $tooltips[ $key ] =
$title . wpautop( esc_html( $tooltip[
'value'] ) );
437 switch ( $column_name ) {
443 if ( empty( $template_id ) ) {
444 gravityview()->log->error(
'View ID {view_id} does not have a connected template.', array(
'view_id' => $post_id ) );
453 $template_id_pretty = ucwords( implode(
' ', explode(
'_', $template_id ) ) );
459 case 'gv_connected_form':
465 gravityview()->log->error(
'View ID {view_id} does not have a connected GF form.', array(
'view_id' => $post_id ) );
466 $output = __(
'Not connected.',
'gk-gravityview' );
473 gravityview()->log->error(
'Connected form not found: Form #{form_id}', array(
'form_id' =>
$form_id ) );
475 $output = __(
'The connected form can not be found; it may no longer exist.',
'gk-gravityview' );
496 if( empty(
$form ) ) {
501 if( !is_array(
$form ) ) {
505 if ( empty(
$form ) ) {
513 $form_url = admin_url( sprintf(
'admin.php?page=gf_edit_forms&id=%d',
$form_id ) );
514 $form_link =
'<strong class="gv-form-title">'.gravityview_get_link( $form_url,
$form[
'title'],
'class=row-title' ).
'</strong>';
515 $links[] =
'<span>'.gravityview_get_link( $form_url, __(
'Edit Form',
'gk-gravityview') ).
'</span>';
517 $form_link =
'<strong class="gv-form-title">'. esc_html(
$form[
'title'] ).
'</strong>';
521 $entries_url = admin_url( sprintf(
'admin.php?page=gf_entries&id=%d',
$form_id ) );
522 $links[] =
'<span>'.gravityview_get_link( $entries_url, __(
'Entries',
'gk-gravityview') ).
'</span>';
525 if(
GVCommon::has_cap( array(
'gravityforms_edit_settings',
'gravityview_view_settings' ) ) ) {
526 $settings_url = admin_url( sprintf(
'admin.php?page=gf_edit_forms&view=settings&id=%d',
$form_id ) );
527 $links[] =
'<span>'.gravityview_get_link( $settings_url, __(
'Settings',
'gk-gravityview'),
'title='.__(
'Edit settings for this form',
'gk-gravityview') ).
'</span>';
530 if(
GVCommon::has_cap( array(
"gravityforms_edit_forms",
"gravityforms_create_form",
"gravityforms_preview_forms") ) ) {
531 $preview_url = site_url( sprintf(
'?gf_page=preview&id=%d',
$form_id ) );
532 $links[] =
'<span>'.gravityview_get_link( $preview_url, __(
'Preview Form',
'gk-gravityview'),
'title='.__(
'Preview this form',
'gk-gravityview') ).
'</span>';
537 if( !empty( $include_form_link ) ) {
547 $links = apply_filters(
'gravityview_connected_form_links', $links,
$form );
549 $css_class =
'row-actions';
552 if(
'excerpt' === get_user_setting(
'posts_list_mode',
'list' ) ) {
553 $css_class =
'row-actions visible';
556 $output .=
'<div class="' . $css_class .
'">'. implode(
' | ', $links ) .
'</div>';
570 $date = $columns[
'date'];
571 unset( $columns[
'date'] );
573 $data_source_required_caps = array(
574 'gravityforms_edit_forms',
575 'gravityforms_view_entries',
576 'gravityforms_edit_settings',
577 'gravityview_view_settings',
578 'gravityforms_create_form',
579 'gravityforms_preview_forms',
583 $columns[
'gv_connected_form'] = __(
'Data Source',
'gk-gravityview' );
586 $columns[
'gv_template'] = _x(
'Template',
'Column title that shows what template is being used for Views',
'gk-gravityview' );
589 $columns[
'date'] = $date;
602 if( defined(
'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
607 if ( ! isset( $_POST[
'post_type'] ) ||
'gravityview' != $_POST[
'post_type'] ) {
613 gravityview()->log->error(
'Current user does not have the capability to edit View {view_id}', array(
'view_id' => $post_id,
'data' => wp_get_current_user() ) );
617 gravityview()->log->debug(
'[save_postdata] Saving View post type.', array(
'data' => $_POST ) );
622 if ( isset( $_POST[
'gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST[
'gravityview_select_form_nonce'],
'gravityview_select_form' ) ) {
624 $form_id = !empty( $_POST[
'gravityview_form_id'] ) ? $_POST[
'gravityview_form_id'] :
'';
626 $statii[
'form_id'] = update_post_meta( $post_id,
'_gravityview_form_id',
$form_id );
630 if(
false ===
GVCommon::has_cap(
'gravityforms_create_form' ) && empty( $statii[
'form_id'] ) ) {
631 gravityview()->log->error(
'Current user does not have the capability to create a new Form.', array(
'data' => wp_get_current_user() ) );
636 if ( ! empty( $_POST[
'gravityview_form_id_start_fresh'] ) ) {
637 $statii[
'start_fresh'] = add_post_meta( $post_id,
'_gravityview_start_fresh', 1 );
639 $statii[
'start_fresh'] = delete_post_meta( $post_id,
'_gravityview_start_fresh' );
643 if ( isset( $_POST[
'gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST[
'gravityview_select_template_nonce'],
'gravityview_select_template' ) ) {
645 $template_id = !empty( $_POST[
'gravityview_directory_template'] ) ? $_POST[
'gravityview_directory_template'] :
'';
648 $statii[
'directory_template'] = update_post_meta( $post_id,
'_gravityview_directory_template', $template_id );
653 if ( isset( $_POST[
'gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST[
'gravityview_view_configuration_nonce'],
'gravityview_view_configuration' ) ) {
656 if( empty( $_POST[
'template_settings'] ) ) {
657 $_POST[
'template_settings'] = array();
659 $statii[
'template_settings'] = update_post_meta( $post_id,
'_gravityview_template_settings', $_POST[
'template_settings'] );
662 if ( isset( $_POST[
'gv_fields'] ) && isset( $_POST[
'gv_fields_done'] ) ) {
665 if ( ! empty( $_POST[
'gv_fields'] ) ) {
669 $fields = wp_slash( $fields );
671 $statii[
'directory_fields'] = update_post_meta( $post_id,
'_gravityview_directory_fields', $fields );
675 if( empty( $_POST[
'widgets'] ) ) {
676 $_POST[
'widgets'] = array();
688 do_action(
'gravityview_view_saved', $post_id, $statii );
690 gravityview()->log->debug(
'[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array(
'data' => array_map(
'intval', $statii ) ) );
697 _deprecated_function(
'GravityView_Admin_Views::render_label()',
'1.1.6',
'Use the GravityView_Admin_View_Field class instead.' );
716 $blocklist_field_types = apply_filters_deprecated(
'gravityview_blacklist_field_types', array( array(), $context ),
'2.14',
'gravityview_blocklist_field_types' );
724 $blocklist_field_types = apply_filters(
'gravityview_blocklist_field_types', $blocklist_field_types, $context );
726 if ( ! is_array( $blocklist_field_types ) ) {
728 gravityview()->log->error(
'$blocklist_field_types is not an array', array(
'data' => print_r( $blocklist_field_types,
true ) ) );
730 $blocklist_field_types = array();
737 if( !empty( $fields ) ) {
739 foreach( $fields as $id => $details ) {
741 if( in_array( $details[
'type'], (array) $blocklist_field_types ) ) {
746 if( $context ===
'edit' && ! empty( $details[
'parent'] ) ) {
758 if( $context ===
'edit' ) {
776 $additional_fields = array(
778 'label_text' => __(
'Add All Form Fields',
'gk-gravityview' ),
779 'desc' => __(
'Insert all the form fields at once.',
'gk-gravityview'),
780 'field_id' =>
'all-fields',
781 'label_type' =>
'field',
782 'input_type' => null,
783 'field_options' => null,
784 'settings_html' => null,
785 'icon' =>
'dashicons-plus-alt',
793 $additional_fields = apply_filters(
'gravityview_additional_fields', $additional_fields );
795 foreach ( (array) $additional_fields as $item ) {
798 $item = wp_parse_args( $item, array(
799 'label_text' => null,
801 'label_type' => null,
802 'input_type' => null,
803 'field_options' => null,
804 'settings_html' => null,
809 if( !empty( $item[
'field_options'] ) ) {
811 $item[
'settings_html'] = $item[
'field_options'];
829 $entry_default_fields = array();
832 if( in_array( $zone, array(
'directory',
'single' ),
true ) ) {
836 $entry_default_fields = array();
838 foreach ( $meta_fields as $meta_field ) {
839 $entry_default_fields += $meta_field->as_array();
849 return apply_filters(
'gravityview_entry_default_fields', $entry_default_fields,
$form, $zone);
860 if( empty(
$form ) ) {
869 if( !is_array(
$form ) ) {
872 $meta_fields = array();
879 $fields = $fields + $meta_fields + $default_fields;
882 if ( isset( $fields[
'custom'] ) ) {
883 $fields = array(
'custom' => $fields[
'custom'] ) + $fields;
888 foreach ( $fields as &
$field ) {
890 if ( \
GV\Utils::get( $field,
'type' ) === $gv_field->name ) {
891 $field[
'icon'] = $gv_field->get_icon();
902 return apply_filters(
'gravityview/admin/available_fields', $fields,
$form, $zone );
914 if ( empty( $widgets ) ) {
918 foreach ( $widgets as $id => $details ) {
932 _deprecated_function( __METHOD__,
'2.0',
'\GV\Widget::registered()' );
934 return \GV\Widget::registered();
949 if( $type ===
'widget' ) {
950 $button_label = __(
'Add Widget',
'gk-gravityview' );
952 $button_label = __(
'Add Field',
'gk-gravityview' );
967 $button_label = apply_filters(
'gravityview/admin/add_button_label', $button_label, array(
'type' => $type,
'template_id' => $template_id,
'zone' => $zone ) );
969 $available_items = array();
976 if( !empty( $values ) && ( !empty( $post->ID ) || ! empty( $_POST[
'template_id'] ) || ! empty( $_POST[
'form_id'] ) ) ) {
978 if ( ! empty( $_POST[
'form_id'] ) ) {
979 $form_id = (int) \
GV\Utils::_POST(
'form_id', 0 );
981 } elseif( ! empty( $_POST[
'template_id'] ) ) {
982 $form_id = esc_attr( $_POST[
'template_id'] );
989 if (
'field' === $type ) {
992 if ( ! empty( $post->ID ) ) {
995 foreach ( $joined_forms as $joined_form ) {
1004 foreach( $rows as $row ) :
1005 foreach( $row as $col => $areas ) :
1006 $column = ($col ==
'2-2') ?
'1-2' : $col; ?>
1008 <div
class=
"gv-grid-col-<?php echo esc_attr( $column ); ?>">
1010 <?php
foreach( $areas as $area ) : ?>
1012 <div
class=
"gv-droppable-area" data-areaid=
"<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context=
"<?php echo esc_attr( $zone ); ?>">
1013 <p
class=
"gv-droppable-area-title" <?php
if (
'widget' === $type && empty( $area[
'subtitle'] ) ) { echo
' style="margin: 0; padding: 0;"'; } ?>>
1014 <strong <?php
if (
'widget' === $type ) { echo
'class="screen-reader-text"'; } ?>><?php echo esc_html( $area[
'title'] ); ?></strong>
1016 <?php
if (
'widget' !== $type ) { ?>
1017 <a
class=
"clear-all-fields alignright" role=
"button" href=
"#" data-areaid=
"<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php esc_html_e(
'Clear all fields',
'gk-gravityview' ); ?></a>
1020 <?php
if ( ! empty( $area[
'subtitle'] ) ) { ?>
1021 <span
class=
"gv-droppable-area-subtitle"><span
class=
"gf_tooltip gv_tooltip tooltip" title=
"<?php echo esc_attr( $area['subtitle'] ); ?>"></span></span>
1024 <div
class=
"active-drop-container active-drop-container-<?php echo esc_attr( $type ); ?>">
1025 <div
class=
"active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid=
"<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php
1026 if( ! empty( $values[ $zone .
'_'. $area[
'areaid'] ] ) ) {
1028 foreach( $values[ $zone .
'_'. $area[
'areaid'] ] as $uniqid =>
$field ) {
1036 $original_item = isset( $available_items[
$form_id ] [
$field[
'id'] ] ) ? $available_items[
$form_id ] [ $field[
'id'] ] : false ;
1038 $original_item = isset( $available_items[
$field[
'id'] ] ) ? $available_items[ $field[
'id'] ] : false ;
1041 if ( ! $original_item ) {
1044 if (
'post-new.php' !== $pagenow ) {
1045 gravityview()->log->error(
'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(
1047 'available_items' => $available_items,
1056 $input_type = isset( $original_item[
'type'] ) ? $original_item[
'type'] : null;
1059 $field_options =
GravityView_Render_Settings::render_field_options(
$form_id, $type, $template_id,
$field[
'id'], $original_item[
'label'], $zone .
'_'. $area[
'areaid'], $input_type, $uniqid,
$field, $zone, $original_item );
1062 'input_type' => $input_type,
1063 'settings_html' => $field_options,
1064 'label_type' => $type,
1068 if ( $original_item ) {
1069 $item = wp_parse_args( $item, $original_item );
1082 <div
class=
"gv-droppable-area-action">
1083 <a href=
"#" class=
"gv-add-field button button-link button-hero" title=
"" 1084 data-objecttype=
"<?php echo esc_attr( $type ); ?>" 1085 data-areaid=
"<?php echo esc_attr( $zone . '_' . $area['areaid'] ); ?>" 1086 data-context=
"<?php echo esc_attr( $zone ); ?>" 1087 data-formid=
"<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo
'<span class="dashicons dashicons-plus-alt"></span>' . esc_html( $button_label ); ?></a>
1113 if ( ! empty( $post_id ) ) {
1114 if (
'auto-draft' === get_post_status( $post_id ) ) {
1117 'header_top' => array(
1118 substr( md5( microtime(
true ) ), 0, 13 ) => array (
1119 'id' =>
'search_bar',
1120 'label' => __(
'Search Bar',
'gk-gravityview' ),
1121 'search_layout' =>
'horizontal',
1122 'search_clear' =>
'0',
1123 'search_fields' =>
'[{"field":"search_all","input":"input_text"}]',
1124 'search_mode' =>
'any',
1127 'header_left' => array(
1128 substr( md5( microtime(
true ) ), 0, 13 ) => array(
1129 'id' =>
'page_info',
1130 'label' => __(
'Show Pagination Info',
'gk-gravityview' ),
1133 'header_right' => array(
1134 substr( md5( microtime(
true ) ), 0, 13 ) => array(
1135 'id' =>
'page_links',
1136 'label' => __(
'Page Links',
'gk-gravityview' ),
1140 'footer_right' => array(
1141 substr( md5( microtime(
true ) ), 0, 13 ) => array(
1142 'id' =>
'page_links',
1143 'label' => __(
'Page Links',
'gk-gravityview' ),
1155 $widgets = apply_filters(
'gravityview/view/widgets/default', $widgets, $template_id, $zone, $post_id );
1164 <div
class=
"gv-grid gv-grid-pad gv-grid-border" id=
"directory-<?php echo $zone; ?>-widgets">
1165 <?php $this->
render_active_areas( $template_id,
'widget', $zone, $default_widget_areas, $widgets ); ?>
1192 if ( $source_form_id ) {
1193 $form_ids[] = $source_form_id;
1197 foreach ( $joined_forms as $joined_form ) {
1198 $form_ids[] = $joined_form->ID;
1201 foreach ( array_unique( $form_ids ) as
$form_id ) {
1202 $filter_field_id = sprintf(
'gv-field-filter-%s-%s', $context, $form_id );
1205 <div
id=
"<?php echo esc_html( $context ); ?>-available-fields-<?php echo esc_attr( $form_id ); ?>" class=
"hide-if-js gv-tooltip">
1206 <button
class=
"close" role=
"button" aria-label=
"<?php esc_html_e( 'Close', 'gk-gravityview' ); ?>"><i
class=
"dashicons dashicons-dismiss"></i></button>
1208 <div
class=
"gv-field-filter-form">
1209 <label
class=
"screen-reader-text" for=
"<?php echo esc_html( $filter_field_id ); ?>"><?php esc_html_e(
'Filter Fields:',
'gk-gravityview' ); ?></label>
1210 <input type=
"search" class=
"widefat gv-field-filter" aria-controls=
"<?php echo $filter_field_id; ?>" id=
"<?php echo esc_html( $filter_field_id ); ?>" placeholder=
"<?php esc_html_e( 'Filter fields by name or label', 'gk-gravityview' ); ?>" />
1211 <div
class=
"button-group">
1212 <span role=
"button" class=
"button button-large gv-items-picker gv-items-picker--grid" data-value=
"grid"><i
class=
"dashicons dashicons-grid-view "></i></span>
1213 <span role=
"button" class=
"button button-large gv-items-picker gv-items-picker--list active" data-value=
"list"><i
class=
"dashicons dashicons-list-view"></i></span>
1217 <div
id=
"available-fields-<?php echo $filter_field_id; ?>" aria-live=
"polite" role=
"listbox" class=
"gv-items-picker-container">
1218 <?php do_action(
'gravityview_render_available_fields', $form_id, $context ); ?>
1221 <div
class=
"gv-no-results hidden description"><?php esc_html_e(
'No fields were found matching the search.',
'gk-gravityview' ); ?></div>
1239 if( empty( $template_id ) ) {
1240 gravityview()->log->debug(
'[render_directory_active_areas] {template_id} is empty', array(
'template_id' => $template_id ) );
1251 $template_areas = apply_filters(
'gravityview_template_active_areas', array(), $template_id, $context );
1253 if( empty( $template_areas ) ) {
1255 gravityview()->log->error(
'[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array(
'data' => $template_id ) );
1258 $output .=
'<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__(
'This View is configured using the %s View type, which is disabled.',
'gk-gravityview' ),
'<em>'.$template_id.
'</em>' ) .
'</h2>';
1259 $output .=
'<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__(
'The data is not lost; re-activate the associated plugin and the configuration will re-appear.',
'gk-gravityview').
'</p>';
1296 $columns = GFFormsModel::get_grid_columns(
$form_id );
1298 $directory_fields = array();
1300 foreach ( $columns as
$column_id => $column ) {
1308 $directory_fields[ uniqid(
'',
true ) ] = array(
1309 'label' => \
GV\Utils::get( $column,
'label' ),
1313 'show_as_link' => empty( $directory_fields ),
1319 $entry_fields = array();
1323 $entry_fields[ uniqid(
'',
true ) ] = array(
1324 'label' => $gv_field->label,
1325 'type' => $gv_field->type,
1326 'id' => $gv_field->id,
1333 $entry_fields[ uniqid(
'',
true ) ] = array(
1334 'label' => esc_html__(
'Edit Entry',
'gk-gravityview' ),
1335 'admin_label' => esc_html__(
'Link to Edit Entry',
'gk-gravityview' ),
1336 'type' =>
'edit_link',
1337 'id' =>
'edit_link',
1343 'directory_table-columns' => $directory_fields,
1344 'single_table-columns' => $entry_fields,
1355 global $plugin_page, $pagenow;
1357 $script_debug = ( defined(
'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ?
'' :
'.min';
1358 $is_widgets_page = ( $pagenow ===
'widgets.php' );
1362 wp_dequeue_script(
'gform_tooltip_init' );
1363 wp_dequeue_style(
'gform_tooltip' );
1364 wp_enqueue_style(
'gravityview_gf_tooltip', plugins_url(
'assets/css/gf_tooltip.css',
GRAVITYVIEW_FILE ), array(), \
GV\Plugin::$version );
1365 wp_enqueue_script(
'gravityview_gf_tooltip', plugins_url(
'assets/js/gf_tooltip' . $script_debug .
'.js',
GRAVITYVIEW_FILE ), array(), \
GV\Plugin::$version );
1369 wp_enqueue_style(
'gravityview_global', plugins_url(
'assets/css/admin-global.css',
GRAVITYVIEW_FILE), array(), \
GV\Plugin::$version );
1370 wp_register_style(
'gravityview_views_styles', plugins_url(
'assets/css/admin-views.css',
GRAVITYVIEW_FILE ), array(
'dashicons',
'wp-jquery-ui-dialog' ), \
GV\Plugin::$version );
1372 wp_register_script(
'gravityview-jquery-cookie', plugins_url(
'assets/lib/jquery.cookie/jquery.cookie.min.js',
GRAVITYVIEW_FILE), array(
'jquery' ), \
GV\Plugin::$version,
true );
1374 if( GFForms::get_page() ===
'form_list' ) {
1375 wp_enqueue_style(
'gravityview_views_styles' );
1380 if( !
gravityview()->request->is_admin( $hook,
'single' ) && ! $is_widgets_page ) {
1384 wp_enqueue_code_editor( array(
'type' =>
'text/html' ) );
1386 wp_enqueue_script(
'jquery-ui-datepicker' );
1388 wp_enqueue_style(
'gravityview_views_datepicker', plugins_url(
'assets/css/admin-datepicker.css',
GRAVITYVIEW_FILE), \
GV\Plugin::$version );
1391 wp_enqueue_script(
'gravityview_views_scripts', plugins_url(
'assets/js/admin-views' . $script_debug .
'.js',
GRAVITYVIEW_FILE ), array(
'jquery-ui-tabs',
'jquery-ui-draggable',
'jquery-ui-droppable',
'jquery-ui-sortable',
'jquery-ui-tooltip',
'jquery-ui-dialog',
'gravityview-jquery-cookie',
'jquery-ui-datepicker',
'underscore' ), \
GV\Plugin::$version );
1393 wp_localize_script(
'gravityview_views_scripts',
'gvGlobals', array(
1394 'cookiepath' => COOKIEPATH,
1395 'admin_cookiepath' => ADMIN_COOKIE_PATH,
1396 'passed_form_id' => (
bool) \
GV\Utils::_GET(
'form_id' ),
1397 'has_merge_tag_listener' => (
bool) version_compare( GFForms::$version,
'2.6.4',
'>=' ),
1398 'nonce' => wp_create_nonce(
'gravityview_ajaxviews' ),
1399 'label_viewname' => __(
'Enter View name here',
'gk-gravityview' ),
1400 'label_reorder_search_fields' => __(
'Reorder Search Fields',
'gk-gravityview' ),
1401 'label_add_search_field' => __(
'Add Search Field',
'gk-gravityview' ),
1402 'label_remove_search_field' => __(
'Remove Search Field',
'gk-gravityview' ),
1403 'label_close' => __(
'Close',
'gk-gravityview' ),
1404 'label_cancel' => __(
'Cancel',
'gk-gravityview' ),
1405 'label_continue' => __(
'Continue',
'gk-gravityview' ),
1406 'label_ok' => __(
'Ok',
'gk-gravityview' ),
1407 'label_publisherror' => __(
'Error while creating the View for you. Check the settings or contact GravityView support.',
'gk-gravityview' ),
1408 'loading_text' => esc_html__(
'Loading…',
'gk-gravityview' ),
1409 'loading_error' => esc_html__(
'There was an error loading dynamic content.',
'gk-gravityview' ),
1410 'field_loaderror' => __(
'Error while adding the field. Please try again or contact GravityView support.',
'gk-gravityview' ),
1411 'remove_all_fields' => __(
'Would you like to remove all fields in this zone?',
'gk-gravityview' ),
1412 'foundation_licenses_router' => array_merge(
1413 GravityKitFoundation::get_ajax_params(
'licenses' ),
1414 array(
'ajaxRoute' =>
'activate_product' )
1419 self::enqueue_gravity_forms_scripts();
1421 wp_enqueue_style(
'gravityview_views_styles' );
1424 if ( is_callable( array(
'GFCommon',
'output_hooks_javascript') ) ) {
1425 GFCommon::output_hooks_javascript();
1437 GFForms::register_scripts();
1441 'gform_gravityforms',
1444 'jquery-ui-autocomplete' 1447 if ( wp_is_mobile() ) {
1448 $scripts[] =
'jquery-touch-punch';
1451 wp_enqueue_script( $scripts );
1454 'gform_admin_icons',
1457 wp_enqueue_style( $styles );
1469 $allowed_dependencies = array();
1471 $filter = current_filter();
1473 if ( preg_match(
'/script/ism', $filter ) ) {
1475 $allowed_dependencies = array(
1479 } elseif ( preg_match(
'/style/ism', $filter ) ) {
1481 $allowed_dependencies = array(
1483 'wp-jquery-ui-dialog',
1487 return array_merge( $registered, $allowed_dependencies );
static _GET( $name, $default=null)
Grab a value from the _GET superglobal or default.
gravityview_set_directory_widgets( $post_id, $widgets=array())
Set the widgets, as configured for a View.
static render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type=NULL, $uniqid='', $current='', $context='single', $item=array())
Render Field Options html (shown through a dialog box)
get_entry_default_fields($form, $zone)
Retrieve the default fields id, label and type.
filter_pre_get_posts(&$query)
if(! isset( $gravityview)||empty( $gravityview->template)) $template
The entry loop for the list output.
suggest_support_articles( $localization_data=array())
When on the Add/Edit View screen, suggest most popular articles related to that.
render_additional_fields( $form_id=0, $context='single')
Render html for displaying additional fields based on a Form ID.
static render_setting_row( $key='', $current_settings=array(), $override_input=null, $name='template_settings[%s]', $id='gravityview_se_%s')
Output a table row for view settings.
gravityview_get_entry_meta( $form_id, $only_default_column=true)
get extra fields from entry meta
static gform_toolbar_menu( $menu_items=array(), $id=NULL)
Add a GravityView menu to the Form Toolbar with connected views.
static get_connected_form_links( $form, $include_form_link=true)
Get HTML links relating to a connected form, like Edit, Entries, Settings, Preview.
gravityview_get_form( $form_id)
Returns the form object for a given Form ID.
gravityview_get_directory_widgets( $post_id)
Get the widgets, as configured for a View.
render_available_fields( $form_id=0, $context='single')
Render html for displaying available fields based on a Form ID.
gravityview_get_directory_fields( $post_id, $apply_filter=true, $form_id=0)
Get the field configuration for the View.
add_custom_column_content( $column_name=null, $post_id=0)
Add the Data Source information.
tooltips( $tooltips=array())
Add tooltip text for use throughout the UI.
add_view_dropdown()
Adds dropdown selects to filter Views by connected form and layout.
If this file is called directly, abort.
if(gravityview() ->plugin->is_GF_25()) $form
set_default_view_fields( $fields=array(), $view=null, $form_id=0)
Set the default fields for new Views.
render_widgets_active_areas( $template_id='', $zone='', $post_id='')
Render the widget active areas.
gravityview_get_forms( $active=true, $trash=false, $order_by='date_created', $order='ASC')
Alias of GFAPI::get_forms()
new GravityView_Admin_Views
static render_field_option( $name='', $option=array(), $curr_value=null)
render_active_areas( $template_id, $type, $zone, $rows, $values)
Generic function to render rows and columns of active areas for widgets & fields. ...
gravityview_get_form_fields( $form='', $add_default_properties=false, $include_parent_field=true)
Return array of fields' id and label, for a given Form ID.
static render_setting_row( $key='', $current_settings=array(), $override_input=null, $name='template_settings[%s]', $id='gravityview_se_%s')
static pre_get_form_fields( $template_id='')
Get the form fields for a preset (no form created yet)
register_no_conflict( $registered)
Add GravityView scripts and styles to Gravity Forms and GravityView No-Conflict modes.
static get_form_or_form_template( $form_id=0)
Returns form object for existing form or a form template.
gravityview_get_connected_views( $form_id, $args=array())
Get the views for a particular form.
add_gf_version_css_class( $class)
Allow targeting different versions of Gravity Forms using CSS selectors.
default_field_blacklist( $array, $context)
gravityview_get_form_id( $view_id)
Get the connected form ID from a View ID.
static render_field_option( $name='', $option=array(), $curr_value=null)
Handle rendering a field option form element.
add_post_type_columns( $columns)
Add the Data Source column to the Views page.
get_registered_widgets()
Get the list of registered widgets.
const GRAVITYVIEW_FILE
Full path to the GravityView file "GRAVITYVIEW_FILE" "./gravityview.php".
gravityview_get_registered_templates()
Get all available preset templates.
render_field_pickers( $context='directory', $form_ids=array())
Renders "Add Field" tooltips.
if(empty( $created_by)) $form_id
_gravityview_process_posted_fields()
Maybe convert jQuery-serialized fields into array, otherwise return $_POST['fields'] array...
gravityview()
The main GravityView wrapper function.
render_available_widgets()
Render html for displaying available widgets.
static get_all( $groups='')
Get all fields.
gravityview_get_template_id( $post_id)
Get the template ID (list, table, datatables, map) for a View.
static get_joined_forms( $post_id)
Get joined forms associated with a view In no particular order.
default_field_blocklist( $array=array(), $context=NULL)
List the field types without presentation properties (on a View context)
static defaults( $detailed=false, $group=null)
Retrieve the default View settings.
render_directory_active_areas( $template_id='', $context='single', $post_id=0, $echo=false, $form_id=0)
Render the Template Active Areas and configured active fields for a given template id and post id...
gravityview_get_joined_forms( $view_id)
Get joined forms associated with a view.
static has_cap( $caps='', $object_id=null, $user_id=null)
Alias of GravityView_Roles_Capabilities::has_cap()
static add_scripts_and_styles( $hook)
Enqueue scripts and styles at Views editor.
get_available_fields( $form='', $zone=NULL)
Calculate the available fields.
static enqueue_gravity_forms_scripts()
Enqueue Gravity Forms scripts, needed for Merge Tags.
static from_post( $post)
Construct a instance from a .
static get_instance( $field_name)
save_postdata( $post_id)
Save View configuration.