From bb89be62d433fc7e711ca6e7880405900144be75 Mon Sep 17 00:00:00 2001 From: omarkasem Date: Thu, 31 Oct 2024 03:15:21 +0300 Subject: [PATCH 01/18] Adds entry is updated notification --- .../edit-entry/class-edit-entry.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/includes/extensions/edit-entry/class-edit-entry.php b/includes/extensions/edit-entry/class-edit-entry.php index 982a5d1d9b..8a26aa3e06 100644 --- a/includes/extensions/edit-entry/class-edit-entry.php +++ b/includes/extensions/edit-entry/class-edit-entry.php @@ -95,6 +95,11 @@ private function add_hooks() { add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 ); add_filter( 'gravityview/api/reserved_query_args', array( $this, 'add_reserved_arg' ) ); + + add_filter( 'gform_notification_events', array( $this, 'add_edit_notification_events' ), 10, 2 ); + + add_action( 'gravityview/edit_entry/after_update', array( $this, 'trigger_notifications' ), 10, 3 ); + } /** @@ -455,6 +460,34 @@ function ( $caps ) { GFForms::delete_file(); } + + /** + * Trigger the notifications. + * + * @since TBD + * + * @param array $form The form object. + * @param int $entry_id The entry ID. + */ + public function trigger_notifications( $form, $entry_id, $edit_entry_render ) { + GravityView_Notifications::send_notifications( (int) $entry_id, 'gravityview/edit_entry/after_update', $edit_entry_render->entry ); + } + + /** + * Add the edit notification event. + * + * @since TBD + * + * @param array $notification_events Existing notification events. + * @param array $form The form object. + * + * @return array + */ + public function add_edit_notification_events( $notification_events = array(), $form = array() ) { + $notification_events['gravityview/edit_entry/after_update'] = 'GravityView - ' . esc_html_x( 'Entry is updated', 'The title for an event in a notifications drop down list.', 'gk-gravityview' ); + return $notification_events; + } + } // end class // add_action( 'plugins_loaded', array('GravityView_Edit_Entry', 'getInstance'), 6 ); From 4de6a4209e72ef8ce24fd8fa174e84df8aeeae0a Mon Sep 17 00:00:00 2001 From: Doeke Norg Date: Tue, 12 Nov 2024 16:52:22 +0100 Subject: [PATCH 02/18] Allow field option filtering on lightbox and new_window settings --- includes/admin/class.render.settings.php | 32 ++++++++++++++---------- readme.txt | 4 +++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/includes/admin/class.render.settings.php b/includes/admin/class.render.settings.php index aa2d9dc585..ffca3cbbc4 100644 --- a/includes/admin/class.render.settings.php +++ b/includes/admin/class.render.settings.php @@ -120,6 +120,25 @@ public static function get_default_field_options( $field_type, $template_id, $fi } } + if ( 'directory' === $context && isset( $field_options['show_as_link'] ) ) { + $field = new class extends GravityView_Field { + public function __construct() { + } + }; + + $field->add_field_support( 'new_window', $field_options ); + $field->add_field_support( 'lightbox', $field_options ); + + $field_options['lightbox'] = array_merge( + $field_options['lightbox'] ?? [], + [ 'requires' => 'show_as_link', 'priority' => 101 ] + ); + $field_options['new_window'] = array_merge( + $field_options['new_window'] ?? [], + [ 'requires' => 'show_as_link', 'priority' => 102 ] + ); + } + // Remove suffix ":" from the labels to standardize style. Using trim() instead of rtrim() for i18n. foreach ( $field_options as $key => $field_option ) { $field_options[ $key ]['label'] = trim( $field_option['label'], ':' ); @@ -153,19 +172,6 @@ public static function get_default_field_options( $field_type, $template_id, $fi */ $field_options = apply_filters( "gravityview_template_{$input_type}_options", $field_options, $template_id, $field_id, $context, $input_type, $form_id ); - if ( 'directory' === $context && isset( $field_options['show_as_link'] ) ) { - $field = new class extends GravityView_Field { - public function __construct() { - } - }; - - $field->add_field_support( 'new_window', $field_options ); - $field->add_field_support( 'lightbox', $field_options ); - - $field_options['lightbox'] = array_merge( $field_options['lightbox'], [ 'requires' => 'show_as_link', 'priority' => 101 ] ); - $field_options['new_window'] = array_merge( $field_options['new_window'], [ 'requires' => 'show_as_link', 'priority' => 102 ] ); - } - if ( $grouped ) { $option_groups = array(); diff --git a/readme.txt b/readme.txt index 2cf8c4a104..3af48889c2 100644 --- a/readme.txt +++ b/readme.txt @@ -21,6 +21,10 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h == Changelog == += develop = + +* Fixed: Some field settings could not be changed with the available filter hooks. + = 2.31.1 on November 8, 2024 = This hotfix release resolves display issues with certain View layouts. From d945832e1f1f921abd60f5d8698532c2e466e6c8 Mon Sep 17 00:00:00 2001 From: Serhiy Zakharchenko Date: Tue, 12 Nov 2024 17:07:54 +0000 Subject: [PATCH 03/18] Filter join conditions #2198 --- future/includes/class-gv-view.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/future/includes/class-gv-view.php b/future/includes/class-gv-view.php index d2ecdf5d95..ab1b862202 100644 --- a/future/includes/class-gv-view.php +++ b/future/includes/class-gv-view.php @@ -1250,6 +1250,8 @@ public function get_entries( $request = null ) { ) ); + $status_conditions = apply_filters( 'gk/gravityview/view/entries/join_conditions', $status_conditions, $join, $this ); + $q = $query->_introspect(); $query->where( \GF_Query_Condition::_and( $q['where'], $status_conditions ) ); From 1306bca0300324861ed5b838a9fb275146ace113 Mon Sep 17 00:00:00 2001 From: Doeke Norg Date: Wed, 13 Nov 2024 11:07:57 +0100 Subject: [PATCH 04/18] Add field option filter hooks --- includes/admin/class.render.settings.php | 324 ++++++++++++++--------- includes/class-admin.php | 1 + 2 files changed, 198 insertions(+), 127 deletions(-) diff --git a/includes/admin/class.render.settings.php b/includes/admin/class.render.settings.php index ffca3cbbc4..46fd4a7364 100644 --- a/includes/admin/class.render.settings.php +++ b/includes/admin/class.render.settings.php @@ -1,4 +1,7 @@ add_field_support( 'new_window', $field_options ); + $field->add_field_support( 'lightbox', $field_options ); + + if ( isset( $field_options['lightbox'] ) ) { + $field_options['lightbox'] = array_merge( + $field_options['lightbox'], + [ 'requires' => 'show_as_link', 'priority' => 101 ] + ); + } + + if ( isset( $field_options['new_window'] ) ) { + $field_options['new_window'] = array_merge( + $field_options['new_window'], + [ 'requires' => 'show_as_link', 'priority' => 102 ] + ); + } + + return $field_options; + } + + /** + * Sorts the field options. + * + * @since $ver$ + * + * @param array $field_options The field options. + * @param 'widget'|'field' $field_type The field type. + * @param string $template_id The template ID. + * @param string $context The context (`single` or `directory`). + * @param bool $grouped Whether the options are supposed to be grouped. + * + * @return array The sorted field options. + */ + public static function maybe_sort_options( + array $field_options, + string $field_type, + string $template_id, + string $context, + bool $grouped + ): array { + if ( ! $grouped ) { + uasort( $field_options, [ __CLASS__, '_sort_by_priority' ] ); + + return $field_options; + } + + $option_groups = []; + + foreach ( $field_options as $key => $field_option ) { + $_group = Utils::get( $field_option, 'group', 'display' ); + + if ( 'show_as_link' === $key ) { + $_group = 'display'; + $field_option['priority'] = 100; + } + + $option_groups[ $_group ][ $key ] = $field_option; + } + + foreach ( $option_groups as &$option_group ) { + uasort( $option_group, [ __CLASS__, '_sort_by_priority' ] ); + } + unset( $option_group ); + + $field_options = []; + foreach ( self::get_field_groups() as $group_key => $group_name ) { + $field_options[ $group_key ] = Utils::get( $option_groups, $group_key, [] ); + } + + return $field_options; + } /** * Get available field groups. @@ -54,18 +168,17 @@ public static function get_default_field_options( $field_type, $template_id, $fi $is_table_layout = preg_match( '/table/ism', $template_id ); if ( 'field' === $field_type ) { - // Default options - fields - $field_options = array( - 'show_label' => array( + $field_options = [ + 'show_label' => [ 'type' => 'checkbox', 'label' => __( 'Show Label', 'gk-gravityview' ), 'value' => ! empty( $is_table_layout ), 'priority' => 1000, 'group' => 'label', 'requires_not' => 'full_width=1', - ), - 'custom_label' => array( + ], + 'custom_label' => [ 'type' => 'text', 'label' => __( 'Custom Label:', 'gk-gravityview' ), 'value' => '', @@ -75,8 +188,8 @@ public static function get_default_field_options( $field_type, $template_id, $fi 'requires' => 'show_label', 'requires_not' => 'full_width=1', 'group' => 'label', - ), - 'custom_class' => array( + ], + 'custom_class' => [ 'type' => 'text', 'label' => __( 'Custom CSS Class:', 'gk-gravityview' ), 'desc' => __( 'This class will be added to the field container', 'gk-gravityview' ), @@ -86,15 +199,15 @@ public static function get_default_field_options( $field_type, $template_id, $fi 'class' => 'widefat code', 'priority' => 5000, 'group' => 'advanced', - ), - 'only_loggedin' => array( + ], + 'only_loggedin' => [ 'type' => 'checkbox', 'label' => __( 'Make visible only to logged-in users?', 'gk-gravityview' ), 'value' => '', 'priority' => 4000, 'group' => 'visibility', - ), - 'only_loggedin_cap' => array( + ], + 'only_loggedin_cap' => [ 'type' => 'select', 'label' => __( 'Make visible for:', 'gk-gravityview' ), 'options' => self::get_cap_choices( $template_id, $field_id, $context, $input_type ), @@ -103,42 +216,24 @@ public static function get_default_field_options( $field_type, $template_id, $fi 'priority' => 4100, 'requires' => 'only_loggedin', 'group' => 'visibility', - ), - ); + ], + ]; // Match Table as well as DataTables if ( $is_table_layout && 'directory' === $context ) { - $field_options['width'] = array( + $field_options['width'] = [ 'type' => 'number', 'label' => __( 'Percent Width', 'gk-gravityview' ), - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gk-gravityview' ), + 'desc' => __( 'Leave blank for column width to be based on the field content.', + 'gk-gravityview' ), 'class' => 'code widefat', 'value' => '', 'priority' => 200, 'group' => 'display', - ); + ]; } } - if ( 'directory' === $context && isset( $field_options['show_as_link'] ) ) { - $field = new class extends GravityView_Field { - public function __construct() { - } - }; - - $field->add_field_support( 'new_window', $field_options ); - $field->add_field_support( 'lightbox', $field_options ); - - $field_options['lightbox'] = array_merge( - $field_options['lightbox'] ?? [], - [ 'requires' => 'show_as_link', 'priority' => 101 ] - ); - $field_options['new_window'] = array_merge( - $field_options['new_window'] ?? [], - [ 'requires' => 'show_as_link', 'priority' => 102 ] - ); - } - // Remove suffix ":" from the labels to standardize style. Using trim() instead of rtrim() for i18n. foreach ( $field_options as $key => $field_option ) { $field_options[ $key ]['label'] = trim( $field_option['label'], ':' ); @@ -172,39 +267,29 @@ public function __construct() { */ $field_options = apply_filters( "gravityview_template_{$input_type}_options", $field_options, $template_id, $field_id, $context, $input_type, $form_id ); - if ( $grouped ) { - - $option_groups = array(); - - foreach ( $field_options as $key => $field_option ) { - - // TODO: Add filter to override instead of doing inline. - switch ( $key ) { - case 'show_as_link': - $_group = 'display'; - $field_option['priority'] = 100; - break; - default: - $_group = \GV\Utils::get( $field_option, 'group', 'display' ); - break; - } - - $option_groups[ $_group ][ $key ] = $field_option; - } - - foreach ( $option_groups as & $option_group ) { - uasort( $option_group, array( __CLASS__, '_sort_by_priority' ) ); - } - - $field_options = array(); - foreach ( self::get_field_groups() as $group_key => $group_name ) { - $field_options[ $group_key ] = \GV\Utils::get( $option_groups, $group_key, array() ); - } - } else { - uasort( $field_options, array( __CLASS__, '_sort_by_priority' ) ); - } - - return $field_options; + /** + * Filters the field options. + * + * @since $ver$ + * + * @filter `gravityview_template_{$input_type}_options` + * + * @param array $field_options Array of field options with `label`, `value`, `type`, `default` keys. + * @param 'widget'|'field' $field_type The field type (`widget` or `field`). + * @param string $template_id The template ID. + * @param string $context The context (`single` or `directory`). + * @param bool $grouped Whether the options should be grouped. + * @param int $form_id The form ID. + */ + return apply_filters( + 'gk/gravityview/template/options', + (array) $field_options, + (string) $field_type, + (string) $template_id, + (string) $context, + (bool) $grouped, + (int) $form_id + ); } /** @@ -220,8 +305,8 @@ public function __construct() { */ public static function _sort_by_priority( $a, $b ) { - $a_priority = \GV\Utils::get( $a, 'priority', 10001 ); - $b_priority = \GV\Utils::get( $b, 'priority', 10001 ); + $a_priority = Utils::get( $a, 'priority', 10001 ); + $b_priority = Utils::get( $b, 'priority', 10001 ); if ( $a_priority === $b_priority ) { return 0; @@ -235,22 +320,22 @@ public static function _sort_by_priority( $a, $b ) { * * Parameters are only to pass to the filter. * - * @param string $template_id Optional. View slug - * @param string $field_id Optional. GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by` - * @param string $context Optional. What context are we in? Example: `single` or `directory` - * @param string $input_type Optional. (textarea, list, select, etc.) + * @param string $template_id Optional. View slug + * @param string $field_id Optional. GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by` + * @param string $context Optional. What context are we in? Example: `single` or `directory` + * @param string $input_type Optional. (textarea, list, select, etc.) + * * @return array Associative array, with the key being the capability and the value being the label shown. */ public static function get_cap_choices( $template_id = '', $field_id = '', $context = '', $input_type = '' ) { - - $select_cap_choices = array( + $select_cap_choices = [ 'read' => __( 'Any Logged-In User', 'gk-gravityview' ), 'publish_posts' => __( 'Author Or Higher', 'gk-gravityview' ), 'gravityforms_view_entries' => __( 'Can View Gravity Forms Entries', 'gk-gravityview' ), 'delete_others_posts' => __( 'Editor Or Higher', 'gk-gravityview' ), 'gravityforms_edit_entries' => __( 'Can Edit Gravity Forms Entries', 'gk-gravityview' ), 'manage_options' => __( 'Administrator', 'gk-gravityview' ), - ); + ]; if ( is_multisite() ) { $select_cap_choices['manage_network'] = __( 'Multisite Super Admin', 'gk-gravityview' ); @@ -272,7 +357,6 @@ public static function get_cap_choices( $template_id = '', $field_id = '', $cont return $select_cap_choices; } - /** * Render Field Options html (shown through a dialog box) * @@ -285,10 +369,10 @@ public static function get_cap_choices( $template_id = '', $field_id = '', $cont * @param string $field_id * @param string $field_label * @param string $area - * @param string $uniqid (default: '') - * @param string $current (default: '') - * @param string $context (default: 'single') - * @param array $item Field or widget array that's being rendered + * @param string $uniqid (default: '') + * @param string $current (default: '') + * @param string $context (default: 'single') + * @param array $item Field or widget array that's being rendered * * @return string HTML of dialog box */ @@ -304,7 +388,7 @@ public static function render_field_options( $form_id, $field_type, $template_id $option_groups = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id, $grouped ); if ( ! $grouped ) { - $option_groups = array( $option_groups ); + $option_groups = [ $option_groups ]; } $option_groups = array_filter( $option_groups ); @@ -343,20 +427,18 @@ public static function render_field_options( $form_id, $field_type, $template_id $field_settings = ''; foreach ( $option_groups as $group_key => $option_group ) { - if ( empty( $option_group ) ) { continue; } if ( $grouped ) { - $group_name = rgar( self::get_field_groups(), $group_key, '' ); + $group_name = rgar( self::get_field_groups(), $group_key, '' ); $field_settings .= '
'; $field_settings .= '' . esc_attr( $group_name ) . ''; } foreach ( $option_group as $key => $option ) { - - $value = isset( $current[ $key ] ) ? $current[ $key ] : null; + $value = $current[ $key ] ?? null; $field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value ); @@ -424,7 +506,7 @@ public static function render_field_options( $form_id, $field_type, $template_id '; } else { $subtitle = ! empty( $item['subtitle'] ) ? '
' . $item['subtitle'] . '
' : ''; - $widget_details_content = \GV\Utils::get( $item, 'description', '' ); + $widget_details_content = Utils::get( $item, 'description', '' ); // Intentionally not escaping to allow HTML. $item_details = '
' . wpautop( trim( $widget_details_content ) ) . '
'; @@ -441,7 +523,7 @@ public static function render_field_options( $form_id, $field_type, $template_id $output = $template; - $replacements = array( + $replacements = [ 'settings_title', 'hidden_fields', 'subtitle', @@ -451,7 +533,7 @@ public static function render_field_options( $form_id, $field_type, $template_id 'field_id', 'form_title', 'form_id', - ); + ]; foreach ( $replacements as $replacement ) { if ( is_null( ${$replacement} ) ) { @@ -471,18 +553,16 @@ public static function render_field_options( $form_id, $field_type, $template_id return $output; } - - /** * Handle rendering a field option form element * - * @param string $name Input `name` attribute - * @param array $option Associative array of options. See the $defaults variable for available keys. - * @param mixed $curr_value Current value of option + * @param string $name Input `name` attribute + * @param array $option Associative array of options. See the $defaults variable for available keys. + * @param mixed $curr_value Current value of option + * * @return string HTML output of option */ - public static function render_field_option( $name = '', $option = array(), $curr_value = null ) { - + public static function render_field_option( $name = '', $option = [], $curr_value = null ) { $output = ''; /** @@ -496,11 +576,9 @@ public static function render_field_option( $name = '', $option = array(), $curr // prepare to render option field type if ( isset( $option['type'] ) ) { - $type_class = self::load_type_class( $option ); if ( class_exists( $type_class ) ) { - /** @type GravityView_FieldType $render_type */ $render_type = new $type_class( $name, $option, $curr_value ); @@ -517,7 +595,7 @@ public static function render_field_option( $name = '', $option = array(), $curr * `$option_type` is the type of setting (`radio`, `text`, etc.). * * @param string $output field class name - * @param array $option option field data + * @param array $option option field data */ $output = apply_filters( "gravityview/option/output/{$option_type}", $output, $option ); } @@ -526,19 +604,16 @@ public static function render_field_option( $name = '', $option = array(), $curr return $output; } - - - - - /** * Output a table row for view settings - * - * @param string $key The key of the input - * @param array $current_settings Associative array of current settings to use as input values, if set. If not set, the defaults are used. - * @param string $override_input [description] - * @param string $name [description] - * @param string $id [description] + * + * @param string $key The key of the input + * @param array $current_settings Associative array of current settings to use as input values, if set. If not + * set, the defaults are used. + * @param string $override_input [description] + * @param string $name [description] + * @param string $id [description] + * * @return void [description] */ public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { @@ -594,7 +669,7 @@ public static function render_setting_row( $key = '', $current_settings = array( // Check if setting is specific for a template if ( ! empty( $setting['show_in_template'] ) ) { if ( ! is_array( $setting['show_in_template'] ) ) { - $setting['show_in_template'] = array( $setting['show_in_template'] ); + $setting['show_in_template'] = [ $setting['show_in_template'] ]; } $show_if = ' data-show-if="' . implode( ' ', $setting['show_in_template'] ) . '"'; } else { @@ -613,15 +688,14 @@ public static function render_setting_row( $key = '', $current_settings = array( echo '' . $output . ''; } - /** * Given a field type calculates the php class. If not found try to load it. - * - * @param array $field + * + * @param array $field + * * @return string type class name */ public static function load_type_class( $field = null ) { - if ( empty( $field['type'] ) ) { return null; } @@ -631,8 +705,8 @@ public static function load_type_class( $field = null ) { /** * Modifies the field type class name to be loaded for a given field. * - * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` - * @param array $field field data + * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` + * @param array $field field data */ $type_class = apply_filters( "gravityview/setting/class/{$field_type}", 'GravityView_FieldType_' . $field_type, $field ); @@ -643,10 +717,12 @@ public static function load_type_class( $field = null ) { /** * Modifies file path to be loaded for a given field. * - * @param string $field_type_include_path field class file path - * @param array $field field data + * @param string $field_type_include_path field class file path + * @param array $field field data */ - $class_file = apply_filters( "gravityview/setting/class_file/{$field_type}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field_type}.php", $field ); + $class_file = apply_filters( "gravityview/setting/class_file/{$field_type}", + GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field_type}.php", + $field ); if ( $class_file && file_exists( $class_file ) ) { require_once $class_file; @@ -655,10 +731,6 @@ public static function load_type_class( $field = null ) { return $type_class; } - - - - /** * @deprecated 1.2 * Render the HTML for a checkbox input to be used on the field & widgets options @@ -667,7 +739,6 @@ public static function load_type_class( $field = null ) { * @return string html tags */ public static function render_checkbox_option( $name = '', $id = '', $current = '' ) { - _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); $output = ''; @@ -676,7 +747,6 @@ public static function render_checkbox_option( $name = '', $id = '', $current = return $output; } - /** * @deprecated 1.2 * Render the HTML for an input text to be used on the field & widgets options diff --git a/includes/class-admin.php b/includes/class-admin.php index 899d3e2b81..f0b60e78f0 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -132,6 +132,7 @@ public function backend_actions() { include_once GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php'; include_once GRAVITYVIEW_DIR . 'includes/class-gravityview-bulk-actions.php'; + GravityView_Render_Settings::register_hooks(); /** * Triggered after all GravityView admin files are loaded. * From 28841931c1b01f1c38f216cfa8604239604fe430 Mon Sep 17 00:00:00 2001 From: Doeke Norg Date: Wed, 13 Nov 2024 13:17:36 +0100 Subject: [PATCH 05/18] update readme [ci skip] --- readme.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.txt b/readme.txt index 3af48889c2..2bffec7830 100644 --- a/readme.txt +++ b/readme.txt @@ -25,6 +25,10 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h * Fixed: Some field settings could not be changed with the available filter hooks. +__Developer Updates:__ + +* Added: `gk/gravityview/template/options` filter in `class.render.settings.php`. + = 2.31.1 on November 8, 2024 = This hotfix release resolves display issues with certain View layouts. From 6cacd4d9d3e400b2430306a29ec9a3383038974b Mon Sep 17 00:00:00 2001 From: Doeke Norg Date: Wed, 13 Nov 2024 14:31:03 +0100 Subject: [PATCH 06/18] Update Readme and Add explaination for high priority filter hooks [ci skip] --- includes/admin/class.render.settings.php | 8 +++++++- readme.txt | 4 +--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/admin/class.render.settings.php b/includes/admin/class.render.settings.php index 46fd4a7364..fe8f1ac857 100644 --- a/includes/admin/class.render.settings.php +++ b/includes/admin/class.render.settings.php @@ -21,8 +21,14 @@ class GravityView_Render_Settings { * @since $ver$ */ public static function register_hooks(): void { + // Filter is applied with priority 500 to act later in the process. It is very likely this filter will be + // used with default or slightly higher than default priorities. This priority makes it likely + // all (or most) options have been processed already. add_filter( 'gk/gravityview/template/options', [ self::class, 'add_general_options' ], 500, 4 ); - add_filter( 'gk/gravityview/template/options', [ self::class, 'maybe_sort_options' ], 900, 5 ); + + // Filter is applied with priority 1000 to act *very* late in the process. This gives users a wide range of + // priority values to work with, while making it very likely those options are still sorted properly. + add_filter( 'gk/gravityview/template/options', [ self::class, 'maybe_sort_options' ], 1000, 5 ); } /** diff --git a/readme.txt b/readme.txt index 2bffec7830..26f94f86a4 100644 --- a/readme.txt +++ b/readme.txt @@ -23,11 +23,9 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h = develop = -* Fixed: Some field settings could not be changed with the available filter hooks. - __Developer Updates:__ -* Added: `gk/gravityview/template/options` filter in `class.render.settings.php`. +* Added: `gk/gravityview/template/options` filter to allow programmatically modifying Field settings in the View editor. = 2.31.1 on November 8, 2024 = From 021022eae4e83621542881a9f1f517eb2fd4cae0 Mon Sep 17 00:00:00 2001 From: omarkasem Date: Wed, 13 Nov 2024 17:06:17 +0200 Subject: [PATCH 07/18] Fixes max files if it's zero --- assets/js/fe-views.js | 6 ++++++ assets/js/fe-views.min.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/assets/js/fe-views.js b/assets/js/fe-views.js index 633728a99c..cee5a0e8d0 100644 --- a/assets/js/fe-views.js +++ b/assets/js/fe-views.js @@ -66,6 +66,9 @@ jQuery( function ( $ ) { uploader.bind('Init', function(up, params) { var data = up.settings; var max = data.gf_vars.max_files; + if(max === 0){ + return; + } var fieldId = data.multipart_params.field_id; var existingFilesCount = $('#preview_existing_files_'+fieldId).children().length; var limitReached = existingFilesCount >= max; @@ -75,6 +78,9 @@ jQuery( function ( $ ) { uploader.bind('FilesAdded', function(up, files) { var data = up.settings; var max = data.gf_vars.max_files; + if(max === 0){ + return; + } var fieldId = data.multipart_params.field_id; var formId = data.multipart_params.form_id; var newFilesCount = $('#gform_preview_'+formId+'_'+fieldId).children().length; diff --git a/assets/js/fe-views.min.js b/assets/js/fe-views.min.js index 736683ca8f..0ae31abc3e 100644 --- a/assets/js/fe-views.min.js +++ b/assets/js/fe-views.min.js @@ -1 +1 @@ -jQuery(function($){({init:function(){this.datepicker(),$(".gv-widget-search").each(function(){$(this).attr("data-state",$(this).serialize())}),$(".gv-widget-search").on("keyup, change",this.form_changed),$(".gv-widget-search .gv-search-field-search_all input[type=search]").on("search",function(e){$(e.target).parents("form").trigger("keyup")}),$(".gv-search-clear").on("click",this.clear_search),$("a.gv-sort").on("click",this.multiclick_sort),this.disable_upload_file_when_limit_reached(),this.fix_updating_files_after_edit(),this.number_range(),this.iframe()},fix_updating_files_after_edit:function(){$.each($(".ginput_preview_list"),function(index,element){return 0<$(element).children().length||void $(element).parents("form").find("[name=gform_uploaded_files]").val("")})},disable_upload_file_when_limit_reached:function(){var checkUploaders=setInterval(function(){"undefined"!=typeof gfMultiFileUploader&&gfMultiFileUploader.uploaders&&(clearInterval(checkUploaders),$.each(gfMultiFileUploader.uploaders,function(index,uploader){uploader.bind("Init",function(existingFilesCount,params){var data=existingFilesCount.settings,max=data.gf_vars.max_files,existingFilesCount=data.multipart_params.field_id,existingFilesCount=$("#preview_existing_files_"+existingFilesCount).children().length;gfMultiFileUploader.toggleDisabled(data,max<=existingFilesCount)}),uploader.bind("FilesAdded",function(up,files){var data=up.settings,max=data.gf_vars.max_files,fieldId=data.multipart_params.field_id,limitReached=data.multipart_params.form_id,limitReached=$("#gform_preview_"+limitReached+"_"+fieldId).children().length,existingFilesCount=$("#preview_existing_files_"+fieldId).children().length,limitReached=max<=existingFilesCount+limitReached;return $.each(files,function(i,file){return 0"+$("
").text(gform_gravityforms.strings.max_reached).html()+""),void setTimeout(function(){wp.a11y.speak($("#"+up.settings.gf_vars.message_id).text())},1e3)))})}))},1)},form_changed:function($form){$form=$($form.target).hasClass("gv-widget-search")?$($form.target):$($form.target).parents("form");$form.serialize()===$form.attr("data-state")?$form.hasClass("gv-is-search")?$(".gv-search-clear",$(this)).text(gvGlobals.clear):$(".gv-search-clear",$(this)).fadeOut(100):$(".gv-search-clear",$(this)).text(gvGlobals.reset).fadeIn(100)},clear_search:function(e){var $form=$(this).parents("form"),changed=$form.attr("data-state")!==$form.serialize();return!(!$form.hasClass("gv-is-search")||changed)||(!changed||(e.preventDefault(),$form.trigger("reset"),!1===$form.hasClass("gv-is-search")?$(".gv-search-clear",$form).hide(100):$(".gv-search-clear",$form).text(gvGlobals.clear),!1))},datepicker:function(){jQuery.fn.datepicker&&$(".gv-datepicker").each(function(){var element=jQuery(this),format="",showOn="focus";element.hasClass("datepicker_with_icon")&&(showOn="both",format=jQuery("#gforms_calendar_icon_"+this.id).val()),gvGlobals.datepicker.showOn=showOn,gvGlobals.datepicker.buttonImage=format,gvGlobals.datepicker.buttonImageOnly=!0,gvGlobals.datepicker.dateFormat||(format="mm/dd/yy",element.hasClass("mdy")?format="mm/dd/yy":element.hasClass("dmy")?format="dd/mm/yy":element.hasClass("dmy_dash")?format="dd-mm-yy":element.hasClass("dmy_dot")?format="dd.mm.yy":element.hasClass("ymd_slash")?format="yy/mm/dd":element.hasClass("ymd_dash")?format="yy-mm-dd":element.hasClass("ymd_dot")&&(format="yy.mm.dd"),gvGlobals.datepicker.dateFormat=format),element.datepicker(gvGlobals.datepicker)})},multiclick_sort:function(e){e.shiftKey&&(e.preventDefault(),location.href=$(this).data("multisort-href"))},number_range(){$(".gv-search-number-range").on("change","input",function(){const $name=$(this).attr("name"),current_type=$name.includes("max")?"max":"min",other_type="max"==current_type?"min":"max",$other=$(this).closest(".gv-search-number-range").find('input[name="'+$name.replace(/(min|max)/,other_type)+'"]');setTimeout(function(){var value;$(this).attr(other_type)&&""!==$(this).val()&&(value=parseFloat($(this).val()),"max"==current_type&&valueparseFloat($(this).attr("max"))&&$(this).val($(this).attr("max"))),$other.attr(current_type,$(this).val())}.bind(this),2)}).find("input").trigger("change")},iframe:function(){window.addEventListener("message",function(event){event.data?.removeHash&&history.replaceState(null,null," "),event.data?.closeFancybox&&window.Fancybox&&(history.replaceState(null,null," "),Fancybox.close()),event.data?.reloadPage?location.reload():event.data?.redirectToUrl&&(window.location=event.data.redirectToUrl)})}}).init()}); \ No newline at end of file +jQuery(function($){({init:function(){this.datepicker(),$(".gv-widget-search").each(function(){$(this).attr("data-state",$(this).serialize())}),$(".gv-widget-search").on("keyup, change",this.form_changed),$(".gv-widget-search .gv-search-field-search_all input[type=search]").on("search",function(e){$(e.target).parents("form").trigger("keyup")}),$(".gv-search-clear").on("click",this.clear_search),$("a.gv-sort").on("click",this.multiclick_sort),this.disable_upload_file_when_limit_reached(),this.fix_updating_files_after_edit(),this.number_range(),this.iframe()},fix_updating_files_after_edit:function(){$.each($(".ginput_preview_list"),function(index,element){return 0<$(element).children().length||void $(element).parents("form").find("[name=gform_uploaded_files]").val("")})},disable_upload_file_when_limit_reached:function(){var checkUploaders=setInterval(function(){"undefined"!=typeof gfMultiFileUploader&&gfMultiFileUploader.uploaders&&(clearInterval(checkUploaders),$.each(gfMultiFileUploader.uploaders,function(index,uploader){uploader.bind("Init",function(existingFilesCount,params){var data=existingFilesCount.settings,max=data.gf_vars.max_files;0!==max&&(existingFilesCount=data.multipart_params.field_id,existingFilesCount=$("#preview_existing_files_"+existingFilesCount).children().length,gfMultiFileUploader.toggleDisabled(data,max<=existingFilesCount))}),uploader.bind("FilesAdded",function(up,files){var data=up.settings,max=data.gf_vars.max_files;if(0!==max){var fieldId=data.multipart_params.field_id,limitReached=data.multipart_params.form_id,limitReached=$("#gform_preview_"+limitReached+"_"+fieldId).children().length,existingFilesCount=$("#preview_existing_files_"+fieldId).children().length,limitReached=max<=existingFilesCount+limitReached;return($.each(files,function(i,file){return 0"+$("
").text(gform_gravityforms.strings.max_reached).html()+""),void setTimeout(function(){wp.a11y.speak($("#"+up.settings.gf_vars.message_id).text())},1e3))}})}))},1)},form_changed:function($form){$form=$($form.target).hasClass("gv-widget-search")?$($form.target):$($form.target).parents("form");$form.serialize()===$form.attr("data-state")?$form.hasClass("gv-is-search")?$(".gv-search-clear",$(this)).text(gvGlobals.clear):$(".gv-search-clear",$(this)).fadeOut(100):$(".gv-search-clear",$(this)).text(gvGlobals.reset).fadeIn(100)},clear_search:function(e){var $form=$(this).parents("form"),changed=$form.attr("data-state")!==$form.serialize();return!(!$form.hasClass("gv-is-search")||changed)||(!changed||(e.preventDefault(),$form.trigger("reset"),!1===$form.hasClass("gv-is-search")?$(".gv-search-clear",$form).hide(100):$(".gv-search-clear",$form).text(gvGlobals.clear),!1))},datepicker:function(){jQuery.fn.datepicker&&$(".gv-datepicker").each(function(){var element=jQuery(this),format="",showOn="focus";element.hasClass("datepicker_with_icon")&&(showOn="both",format=jQuery("#gforms_calendar_icon_"+this.id).val()),gvGlobals.datepicker.showOn=showOn,gvGlobals.datepicker.buttonImage=format,gvGlobals.datepicker.buttonImageOnly=!0,gvGlobals.datepicker.dateFormat||(format="mm/dd/yy",element.hasClass("mdy")?format="mm/dd/yy":element.hasClass("dmy")?format="dd/mm/yy":element.hasClass("dmy_dash")?format="dd-mm-yy":element.hasClass("dmy_dot")?format="dd.mm.yy":element.hasClass("ymd_slash")?format="yy/mm/dd":element.hasClass("ymd_dash")?format="yy-mm-dd":element.hasClass("ymd_dot")&&(format="yy.mm.dd"),gvGlobals.datepicker.dateFormat=format),element.datepicker(gvGlobals.datepicker)})},multiclick_sort:function(e){e.shiftKey&&(e.preventDefault(),location.href=$(this).data("multisort-href"))},number_range(){$(".gv-search-number-range").on("change","input",function(){const $name=$(this).attr("name"),current_type=$name.includes("max")?"max":"min",other_type="max"==current_type?"min":"max",$other=$(this).closest(".gv-search-number-range").find('input[name="'+$name.replace(/(min|max)/,other_type)+'"]');setTimeout(function(){var value;$(this).attr(other_type)&&""!==$(this).val()&&(value=parseFloat($(this).val()),"max"==current_type&&valueparseFloat($(this).attr("max"))&&$(this).val($(this).attr("max"))),$other.attr(current_type,$(this).val())}.bind(this),2)}).find("input").trigger("change")},iframe:function(){window.addEventListener("message",function(event){event.data?.removeHash&&history.replaceState(null,null," "),event.data?.closeFancybox&&window.Fancybox&&(history.replaceState(null,null," "),Fancybox.close()),event.data?.reloadPage?location.reload():event.data?.redirectToUrl&&(window.location=event.data.redirectToUrl)})}}).init()}); \ No newline at end of file From dcaf2b6928c539d5eb5a828ff502f86faabc50e5 Mon Sep 17 00:00:00 2001 From: Serhiy Zakharchenko Date: Wed, 13 Nov 2024 20:28:25 +0000 Subject: [PATCH 08/18] Use class imports, document the new hook #2198 --- future/includes/class-gv-view.php | 86 ++++++++++++++++++------------- readme.txt | 5 ++ 2 files changed, 55 insertions(+), 36 deletions(-) diff --git a/future/includes/class-gv-view.php b/future/includes/class-gv-view.php index ab1b862202..ac8c7ca7c3 100644 --- a/future/includes/class-gv-view.php +++ b/future/includes/class-gv-view.php @@ -2,6 +2,9 @@ namespace GV; +use GF_Query_Column; +use GF_Query_Condition; +use GF_Query_Literal; use GravityKit\GravityView\Foundation\Helpers\Arr; use GF_Query; use GravityKitFoundation; @@ -1147,7 +1150,7 @@ public function get_entries( $request = null ) { continue; } - $order = new \GF_Query_Column( $field['id'], $this->form->ID ); + $order = new GF_Query_Column( $field['id'], $this->form->ID ); if ( 'id' !== $field['id'] && (int) $field['is_numeric'] ) { $order = \GF_Query_Call::CAST( $order, defined( 'GF_Query::TYPE_DECIMAL' ) ? \GF_Query::TYPE_DECIMAL : \GF_Query::TYPE_SIGNED ); @@ -1172,10 +1175,10 @@ public function get_entries( $request = null ) { $column = null; - if ( $order[0] instanceof \GF_Query_Column ) { + if ( $order[0] instanceof GF_Query_Column ) { $column = $order[0]; } elseif ( $order[0] instanceof \GF_Query_Call ) { - if ( 1 != count( $order[0]->columns ) || ! $order[0]->columns[0] instanceof \GF_Query_Column ) { + if ( 1 != count( $order[0]->columns ) || ! $order[0]->columns[0] instanceof GF_Query_Column ) { $orders[ $oid ] = $order; continue; // Need something that resembles a single sort } @@ -1225,35 +1228,46 @@ public function get_entries( $request = null ) { if ( $this->settings->get( 'multiple_forms_disable_null_joins' ) ) { // Disable NULL outputs - $condition = new \GF_Query_Condition( - new \GF_Query_Column( $join->join_on_column->ID, $join->join_on->ID ), - \GF_Query_Condition::NEQ, - new \GF_Query_Literal( '' ) + $condition = new GF_Query_Condition( + new GF_Query_Column( $join->join_on_column->ID, $join->join_on->ID ), + GF_Query_Condition::NEQ, + new GF_Query_Literal( '' ) ); $query_parameters = $query->_introspect(); - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); + $query->where( GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); } // Filter to active entries only - $status_conditions = \GF_Query_Condition::_or( - new \GF_Query_Condition( - new \GF_Query_Column( 'status', $join->join_on->ID ), - \GF_Query_Condition::EQ, - new \GF_Query_Literal( 'active' ) + $status_conditions = GF_Query_Condition::_or( + new GF_Query_Condition( + new GF_Query_Column( 'status', $join->join_on->ID ), + GF_Query_Condition::EQ, + new GF_Query_Literal( 'active' ) ), - new \GF_Query_Condition( - new \GF_Query_Column( 'status', $join->join_on->ID ), - \GF_Query_Condition::IS, - \GF_Query_Condition::NULL + new GF_Query_Condition( + new GF_Query_Column( 'status', $join->join_on->ID ), + GF_Query_Condition::IS, + GF_Query_Condition::NULL ) ); - $status_conditions = apply_filters( 'gk/gravityview/view/entries/join_conditions', $status_conditions, $join, $this ); + /** + * Modifies the join conditions applied during the retrieval of View entries. + * + * @filter `gk/gravityview/view/entries/join-conditions` + * + * @since $ver$ + * + * @param GF_Query_Condition $status_conditions The GF_Query_Condition instance. + * @param Join $join The Join instance. + * @param View $this The View instance. + */ + $status_conditions = apply_filters( 'gk/gravityview/view/entries/join-conditions', $status_conditions, $join, $this ); $q = $query->_introspect(); - $query->where( \GF_Query_Condition::_and( $q['where'], $status_conditions ) ); + $query->where( GF_Query_Condition::_and( $q['where'], $status_conditions ) ); /** * Applies legacy modifications to Query for is_approved settings. @@ -1270,11 +1284,11 @@ public function get_entries( $request = null ) { $unions_sql = array(); /** - * @param \GF_Query_Condition $condition + * @param GF_Query_Condition $condition * @param array $fields * @param $recurse * - * @return \GF_Query_Condition + * @return GF_Query_Condition */ $where_union_substitute = function ( $condition, $fields, $recurse ) { if ( $condition->expressions ) { @@ -1290,9 +1304,9 @@ public function get_entries( $request = null ) { ); } - if ( ! ( $condition->left && $condition->left instanceof \GF_Query_Column ) || ( ! $condition->left->is_entry_column() && ! $condition->left->is_meta_column() ) ) { - return new \GF_Query_Condition( - new \GF_Query_Column( $fields[ $condition->left->field_id ]->ID ), + if ( ! ( $condition->left && $condition->left instanceof GF_Query_Column ) || ( ! $condition->left->is_entry_column() && ! $condition->left->is_meta_column() ) ) { + return new GF_Query_Condition( + new GF_Query_Column( $fields[ $condition->left->field_id ]->ID ), $condition->operator, $condition->right ); @@ -1316,9 +1330,9 @@ public function get_entries( $request = null ) { foreach ( $query_parameters['order'] as $order ) { [ $column, $_order ] = $order; - if ( $column && $column instanceof \GF_Query_Column ) { + if ( $column && $column instanceof GF_Query_Column ) { if ( ! $column->is_entry_column() && ! $column->is_meta_column() ) { - $column = new \GF_Query_Column( $fields[ $column->field_id ]->ID ); + $column = new GF_Query_Column( $fields[ $column->field_id ]->ID ); } $q->order( $column, $_order ); @@ -1858,24 +1872,24 @@ protected function apply_legacy_join_is_approved_query_conditions( \GF_Query $qu } // Show only approved joined entries - $condition = new \GF_Query_Condition( - new \GF_Query_Column( \GravityView_Entry_Approval::meta_key, $join->join_on->ID ), - \GF_Query_Condition::EQ, - new \GF_Query_Literal( \GravityView_Entry_Approval_Status::APPROVED ) + $condition = new GF_Query_Condition( + new GF_Query_Column( \GravityView_Entry_Approval::meta_key, $join->join_on->ID ), + GF_Query_Condition::EQ, + new GF_Query_Literal( \GravityView_Entry_Approval_Status::APPROVED ) ); - $condition = \GF_Query_Condition::_or( + $condition = GF_Query_Condition::_or( $condition, - new \GF_Query_Condition( - new \GF_Query_Column( \GravityView_Entry_Approval::meta_key, $join->join_on->ID ), - \GF_Query_Condition::IS, - \GF_Query_Condition::NULL + new GF_Query_Condition( + new GF_Query_Column( \GravityView_Entry_Approval::meta_key, $join->join_on->ID ), + GF_Query_Condition::IS, + GF_Query_Condition::NULL ) ); $query_parameters = $query->_introspect(); - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); + $query->where( GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); } /** diff --git a/readme.txt b/readme.txt index 2cf8c4a104..69499196a1 100644 --- a/readme.txt +++ b/readme.txt @@ -21,6 +21,11 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h == Changelog == += develop = + +#### 💻 Developer Updates +* Added `gk/gravityview/view/entries/join-conditions` filter to modify the join conditions applied during the retrieval of View entries. + = 2.31.1 on November 8, 2024 = This hotfix release resolves display issues with certain View layouts. From 9a9207912af0213c619ba6ba829db4b8d099048d Mon Sep 17 00:00:00 2001 From: omarkasem Date: Fri, 15 Nov 2024 13:07:57 +0200 Subject: [PATCH 09/18] Fixes message showing --- assets/js/fe-views.js | 8 +++++--- assets/js/fe-views.min.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/js/fe-views.js b/assets/js/fe-views.js index cee5a0e8d0..b5167313b4 100644 --- a/assets/js/fe-views.js +++ b/assets/js/fe-views.js @@ -100,20 +100,22 @@ jQuery( function ( $ ) { gfMultiFileUploader.toggleDisabled(data, limitReached); - // Only show message if max is greater than 1 - if(max <= 1){ + // Only show message if max is greater than 1 or limit is reached + if(max <= 1 || !limitReached){ return true; } - // Check if message already exists + // Check if message already exists if($("#" + up.settings.gf_vars.message_id).children().length > 0){ return true; } + $( "#" + up.settings.gf_vars.message_id ).prepend( "
  • " + $('
    ').text(gform_gravityforms.strings.max_reached).html() + "
  • " ); + // Announce errors. setTimeout(function () { wp.a11y.speak( $( "#" + up.settings.gf_vars.message_id ).text() ); diff --git a/assets/js/fe-views.min.js b/assets/js/fe-views.min.js index 0ae31abc3e..9c5ad6f939 100644 --- a/assets/js/fe-views.min.js +++ b/assets/js/fe-views.min.js @@ -1 +1 @@ -jQuery(function($){({init:function(){this.datepicker(),$(".gv-widget-search").each(function(){$(this).attr("data-state",$(this).serialize())}),$(".gv-widget-search").on("keyup, change",this.form_changed),$(".gv-widget-search .gv-search-field-search_all input[type=search]").on("search",function(e){$(e.target).parents("form").trigger("keyup")}),$(".gv-search-clear").on("click",this.clear_search),$("a.gv-sort").on("click",this.multiclick_sort),this.disable_upload_file_when_limit_reached(),this.fix_updating_files_after_edit(),this.number_range(),this.iframe()},fix_updating_files_after_edit:function(){$.each($(".ginput_preview_list"),function(index,element){return 0<$(element).children().length||void $(element).parents("form").find("[name=gform_uploaded_files]").val("")})},disable_upload_file_when_limit_reached:function(){var checkUploaders=setInterval(function(){"undefined"!=typeof gfMultiFileUploader&&gfMultiFileUploader.uploaders&&(clearInterval(checkUploaders),$.each(gfMultiFileUploader.uploaders,function(index,uploader){uploader.bind("Init",function(existingFilesCount,params){var data=existingFilesCount.settings,max=data.gf_vars.max_files;0!==max&&(existingFilesCount=data.multipart_params.field_id,existingFilesCount=$("#preview_existing_files_"+existingFilesCount).children().length,gfMultiFileUploader.toggleDisabled(data,max<=existingFilesCount))}),uploader.bind("FilesAdded",function(up,files){var data=up.settings,max=data.gf_vars.max_files;if(0!==max){var fieldId=data.multipart_params.field_id,limitReached=data.multipart_params.form_id,limitReached=$("#gform_preview_"+limitReached+"_"+fieldId).children().length,existingFilesCount=$("#preview_existing_files_"+fieldId).children().length,limitReached=max<=existingFilesCount+limitReached;return($.each(files,function(i,file){return 0"+$("
    ").text(gform_gravityforms.strings.max_reached).html()+""),void setTimeout(function(){wp.a11y.speak($("#"+up.settings.gf_vars.message_id).text())},1e3))}})}))},1)},form_changed:function($form){$form=$($form.target).hasClass("gv-widget-search")?$($form.target):$($form.target).parents("form");$form.serialize()===$form.attr("data-state")?$form.hasClass("gv-is-search")?$(".gv-search-clear",$(this)).text(gvGlobals.clear):$(".gv-search-clear",$(this)).fadeOut(100):$(".gv-search-clear",$(this)).text(gvGlobals.reset).fadeIn(100)},clear_search:function(e){var $form=$(this).parents("form"),changed=$form.attr("data-state")!==$form.serialize();return!(!$form.hasClass("gv-is-search")||changed)||(!changed||(e.preventDefault(),$form.trigger("reset"),!1===$form.hasClass("gv-is-search")?$(".gv-search-clear",$form).hide(100):$(".gv-search-clear",$form).text(gvGlobals.clear),!1))},datepicker:function(){jQuery.fn.datepicker&&$(".gv-datepicker").each(function(){var element=jQuery(this),format="",showOn="focus";element.hasClass("datepicker_with_icon")&&(showOn="both",format=jQuery("#gforms_calendar_icon_"+this.id).val()),gvGlobals.datepicker.showOn=showOn,gvGlobals.datepicker.buttonImage=format,gvGlobals.datepicker.buttonImageOnly=!0,gvGlobals.datepicker.dateFormat||(format="mm/dd/yy",element.hasClass("mdy")?format="mm/dd/yy":element.hasClass("dmy")?format="dd/mm/yy":element.hasClass("dmy_dash")?format="dd-mm-yy":element.hasClass("dmy_dot")?format="dd.mm.yy":element.hasClass("ymd_slash")?format="yy/mm/dd":element.hasClass("ymd_dash")?format="yy-mm-dd":element.hasClass("ymd_dot")&&(format="yy.mm.dd"),gvGlobals.datepicker.dateFormat=format),element.datepicker(gvGlobals.datepicker)})},multiclick_sort:function(e){e.shiftKey&&(e.preventDefault(),location.href=$(this).data("multisort-href"))},number_range(){$(".gv-search-number-range").on("change","input",function(){const $name=$(this).attr("name"),current_type=$name.includes("max")?"max":"min",other_type="max"==current_type?"min":"max",$other=$(this).closest(".gv-search-number-range").find('input[name="'+$name.replace(/(min|max)/,other_type)+'"]');setTimeout(function(){var value;$(this).attr(other_type)&&""!==$(this).val()&&(value=parseFloat($(this).val()),"max"==current_type&&valueparseFloat($(this).attr("max"))&&$(this).val($(this).attr("max"))),$other.attr(current_type,$(this).val())}.bind(this),2)}).find("input").trigger("change")},iframe:function(){window.addEventListener("message",function(event){event.data?.removeHash&&history.replaceState(null,null," "),event.data?.closeFancybox&&window.Fancybox&&(history.replaceState(null,null," "),Fancybox.close()),event.data?.reloadPage?location.reload():event.data?.redirectToUrl&&(window.location=event.data.redirectToUrl)})}}).init()}); \ No newline at end of file +jQuery(function($){({init:function(){this.datepicker(),$(".gv-widget-search").each(function(){$(this).attr("data-state",$(this).serialize())}),$(".gv-widget-search").on("keyup, change",this.form_changed),$(".gv-widget-search .gv-search-field-search_all input[type=search]").on("search",function(e){$(e.target).parents("form").trigger("keyup")}),$(".gv-search-clear").on("click",this.clear_search),$("a.gv-sort").on("click",this.multiclick_sort),this.disable_upload_file_when_limit_reached(),this.fix_updating_files_after_edit(),this.number_range(),this.iframe()},fix_updating_files_after_edit:function(){$.each($(".ginput_preview_list"),function(index,element){return 0<$(element).children().length||void $(element).parents("form").find("[name=gform_uploaded_files]").val("")})},disable_upload_file_when_limit_reached:function(){var checkUploaders=setInterval(function(){"undefined"!=typeof gfMultiFileUploader&&gfMultiFileUploader.uploaders&&(clearInterval(checkUploaders),$.each(gfMultiFileUploader.uploaders,function(index,uploader){uploader.bind("Init",function(existingFilesCount,params){var data=existingFilesCount.settings,max=data.gf_vars.max_files;0!==max&&(existingFilesCount=data.multipart_params.field_id,existingFilesCount=$("#preview_existing_files_"+existingFilesCount).children().length,gfMultiFileUploader.toggleDisabled(data,max<=existingFilesCount))}),uploader.bind("FilesAdded",function(up,files){var data=up.settings,max=data.gf_vars.max_files;if(0!==max){var fieldId=data.multipart_params.field_id,limitReached=data.multipart_params.form_id,limitReached=$("#gform_preview_"+limitReached+"_"+fieldId).children().length,existingFilesCount=$("#preview_existing_files_"+fieldId).children().length,limitReached=max<=existingFilesCount+limitReached;return($.each(files,function(i,file){return 0"+$("
    ").text(gform_gravityforms.strings.max_reached).html()+""),void setTimeout(function(){wp.a11y.speak($("#"+up.settings.gf_vars.message_id).text())},1e3))}})}))},1)},form_changed:function($form){$form=$($form.target).hasClass("gv-widget-search")?$($form.target):$($form.target).parents("form");$form.serialize()===$form.attr("data-state")?$form.hasClass("gv-is-search")?$(".gv-search-clear",$(this)).text(gvGlobals.clear):$(".gv-search-clear",$(this)).fadeOut(100):$(".gv-search-clear",$(this)).text(gvGlobals.reset).fadeIn(100)},clear_search:function(e){var $form=$(this).parents("form"),changed=$form.attr("data-state")!==$form.serialize();return!(!$form.hasClass("gv-is-search")||changed)||(!changed||(e.preventDefault(),$form.trigger("reset"),!1===$form.hasClass("gv-is-search")?$(".gv-search-clear",$form).hide(100):$(".gv-search-clear",$form).text(gvGlobals.clear),!1))},datepicker:function(){jQuery.fn.datepicker&&$(".gv-datepicker").each(function(){var element=jQuery(this),format="",showOn="focus";element.hasClass("datepicker_with_icon")&&(showOn="both",format=jQuery("#gforms_calendar_icon_"+this.id).val()),gvGlobals.datepicker.showOn=showOn,gvGlobals.datepicker.buttonImage=format,gvGlobals.datepicker.buttonImageOnly=!0,gvGlobals.datepicker.dateFormat||(format="mm/dd/yy",element.hasClass("mdy")?format="mm/dd/yy":element.hasClass("dmy")?format="dd/mm/yy":element.hasClass("dmy_dash")?format="dd-mm-yy":element.hasClass("dmy_dot")?format="dd.mm.yy":element.hasClass("ymd_slash")?format="yy/mm/dd":element.hasClass("ymd_dash")?format="yy-mm-dd":element.hasClass("ymd_dot")&&(format="yy.mm.dd"),gvGlobals.datepicker.dateFormat=format),element.datepicker(gvGlobals.datepicker)})},multiclick_sort:function(e){e.shiftKey&&(e.preventDefault(),location.href=$(this).data("multisort-href"))},number_range(){$(".gv-search-number-range").on("change","input",function(){const $name=$(this).attr("name"),current_type=$name.includes("max")?"max":"min",other_type="max"==current_type?"min":"max",$other=$(this).closest(".gv-search-number-range").find('input[name="'+$name.replace(/(min|max)/,other_type)+'"]');setTimeout(function(){var value;$(this).attr(other_type)&&""!==$(this).val()&&(value=parseFloat($(this).val()),"max"==current_type&&valueparseFloat($(this).attr("max"))&&$(this).val($(this).attr("max"))),$other.attr(current_type,$(this).val())}.bind(this),2)}).find("input").trigger("change")},iframe:function(){window.addEventListener("message",function(event){event.data?.removeHash&&history.replaceState(null,null," "),event.data?.closeFancybox&&window.Fancybox&&(history.replaceState(null,null," "),Fancybox.close()),event.data?.reloadPage?location.reload():event.data?.redirectToUrl&&(window.location=event.data.redirectToUrl)})}}).init()}); \ No newline at end of file From cf9276ee2173d7c60190d35c40bb3f9fefc73fb3 Mon Sep 17 00:00:00 2001 From: omarkasem Date: Mon, 18 Nov 2024 08:51:49 +0200 Subject: [PATCH 10/18] Fixes upload buttons not sohiwng up --- includes/extensions/edit-entry/class-edit-entry-render.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/extensions/edit-entry/class-edit-entry-render.php b/includes/extensions/edit-entry/class-edit-entry-render.php index 450e849d0c..30987be9ad 100644 --- a/includes/extensions/edit-entry/class-edit-entry-render.php +++ b/includes/extensions/edit-entry/class-edit-entry-render.php @@ -332,6 +332,12 @@ private function print_scripts() { // File download/delete icons wp_enqueue_style( 'gform_admin_icons' ); + + // Fixes the icons not showing up correctly in Gravity Forms 2.9+ + if ( version_compare( GFForms::$version, '2.9', '>=' ) ) { + wp_add_inline_style( 'gform_theme', '.gform-icon { font-family: gform-icons-admin !important; }' ); + } + } From c72774b88ada5ea242037b9a17f8aa9c0690eebd Mon Sep 17 00:00:00 2001 From: Doeke Norg Date: Tue, 19 Nov 2024 12:55:52 +0100 Subject: [PATCH 11/18] Add gravityview/row-added JS-event --- assets/js/admin-grid.js | 11 +++++++++++ readme.txt | 1 + 2 files changed, 12 insertions(+) diff --git a/assets/js/admin-grid.js b/assets/js/admin-grid.js index c4349d19dd..dc3f8fe9a7 100644 --- a/assets/js/admin-grid.js +++ b/assets/js/admin-grid.js @@ -64,6 +64,17 @@ const $row = $( result?.row ); $row.insertBefore( $add_row ); + $( document.body ).trigger( + 'gravityview/row-added', + $row, + { + type, + row_type, + zone, + template_id + } + ); + window?.gvAdminActions?.initTooltips(); window?.gvAdminActions?.initDroppables( $row ); } ) ); diff --git a/readme.txt b/readme.txt index 26f94f86a4..6a61e4fd9e 100644 --- a/readme.txt +++ b/readme.txt @@ -26,6 +26,7 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h __Developer Updates:__ * Added: `gk/gravityview/template/options` filter to allow programmatically modifying Field settings in the View editor. +* Added: `gravityview/row-added` JavaScript event when a new row is added to a Widget/Field area. = 2.31.1 on November 8, 2024 = From 26225f99ee94da22428934ef74aa25f37b3f5404 Mon Sep 17 00:00:00 2001 From: Doeke Norg Date: Wed, 20 Nov 2024 09:11:45 +0100 Subject: [PATCH 12/18] Remove deprecated is_html5 check --- templates/deprecated/fields/post_image.php | 4 ++-- templates/fields/field-post_image-html.php | 4 ++-- tests/unit-tests/GravityView_Future_Test.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/deprecated/fields/post_image.php b/templates/deprecated/fields/post_image.php index e6e63ff519..a6cb2c3195 100644 --- a/templates/deprecated/fields/post_image.php +++ b/templates/deprecated/fields/post_image.php @@ -117,7 +117,7 @@ 'label' => esc_attr_x( 'Caption:', 'Post Image field caption heading', 'gk-gravityview' ), 'value' => $caption, 'tag_label' => 'span', - 'tag_value' => GFFormsModel::is_html5_enabled() ? 'figcaption' : 'div', + 'tag_value' => 'figcaption', ), 'description' => array( 'label' => esc_attr_x( 'Description:', 'Post Image field description heading', 'gk-gravityview' ), @@ -129,7 +129,7 @@ ); // If HTML5 output is enabled, support the `figure` and `figcaption` tags -$wrappertag = GFFormsModel::is_html5_enabled() ? 'figure' : 'div'; +$wrappertag = 'figure'; /** * Whether to show labels for the image meta. diff --git a/templates/fields/field-post_image-html.php b/templates/fields/field-post_image-html.php index 1ba9250c0a..801cb37bd3 100644 --- a/templates/fields/field-post_image-html.php +++ b/templates/fields/field-post_image-html.php @@ -122,7 +122,7 @@ 'label' => esc_attr_x( 'Caption:', 'Post Image field caption heading', 'gk-gravityview' ), 'value' => $caption, 'tag_label' => 'span', - 'tag_value' => GFFormsModel::is_html5_enabled() ? 'figcaption' : 'div', + 'tag_value' => 'figcaption', ), 'description' => array( 'label' => esc_attr_x( 'Description:', 'Post Image field description heading', 'gk-gravityview' ), @@ -134,7 +134,7 @@ ); // If HTML5 output is enabled, support the `figure` and `figcaption` tags -$wrappertag = GFFormsModel::is_html5_enabled() ? 'figure' : 'div'; +$wrappertag = 'figure'; /** * Whether to show labels for the image meta. diff --git a/tests/unit-tests/GravityView_Future_Test.php b/tests/unit-tests/GravityView_Future_Test.php index 6c8d28ccf9..95ca501033 100644 --- a/tests/unit-tests/GravityView_Future_Test.php +++ b/tests/unit-tests/GravityView_Future_Test.php @@ -4259,8 +4259,8 @@ public function test_frontend_field_html_post() { $this->assertEquals( strlen( implode( ', ', $expected ) ), strlen( $renderer->render( $field, $view, $form, $entry, $request ) ) ); /** Post Image */ - $image_tag = GFFormsModel::is_html5_enabled() ? 'figure' : 'div'; - $image_caption_tag = GFFormsModel::is_html5_enabled() ? 'figcaption' : 'div'; + $image_tag = 'figure'; + $image_caption_tag = 'figcaption'; $field = \GV\GF_Field::by_id( $form, '24' ); $expected = sprintf('<%1$s class="gv-image">cap<script>tion</script>
    Title:
    <script>TITLE</script> huh, <b>wut</b>
    Caption: <%2$s class="gv-image-value">cap<script>tion</script>
    Description:
    de's<script>tion</script>
    ', $image_tag, $image_caption_tag); $this->assertEquals( $expected, $renderer->render( $field, $view, $form, $entry, $request ) ); From 290e52fb97f3056562f6b4b1a9ac78113cc02246 Mon Sep 17 00:00:00 2001 From: Doeke Norg Date: Wed, 20 Nov 2024 09:22:26 +0100 Subject: [PATCH 13/18] Clear form display cache for every test --- tests/unit-tests/GravityView_Edit_Entry_Test.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/unit-tests/GravityView_Edit_Entry_Test.php b/tests/unit-tests/GravityView_Edit_Entry_Test.php index e16456926d..3d7253e721 100644 --- a/tests/unit-tests/GravityView_Edit_Entry_Test.php +++ b/tests/unit-tests/GravityView_Edit_Entry_Test.php @@ -476,6 +476,11 @@ private function _reset_context() { * and second item the render instance, and third item is the reloaded entry. */ private function _emulate_render( $form, $view, $entry ) { + // Get clean form every test. + if ( method_exists( GFFormDisplay::class, 'flush_cached_forms' ) ) { + GFFormDisplay::flush_cached_forms(); + } + $loader = GravityView_Edit_Entry::getInstance(); $render = $loader->instances['render']; From 32fa4af022e53c1ee0c3b3bc25e51a3c7b48cac0 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 20 Nov 2024 09:21:25 -0500 Subject: [PATCH 14/18] Add missing docblock parameter, use short array syntax [ci skip] --- .../edit-entry/class-edit-entry.php | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/includes/extensions/edit-entry/class-edit-entry.php b/includes/extensions/edit-entry/class-edit-entry.php index 8a26aa3e06..3d6b2c322d 100644 --- a/includes/extensions/edit-entry/class-edit-entry.php +++ b/includes/extensions/edit-entry/class-edit-entry.php @@ -17,7 +17,6 @@ class GravityView_Edit_Entry { - /** * @var string */ @@ -462,33 +461,33 @@ function ( $caps ) { } /** - * Trigger the notifications. + * Triggers notifications. * * @since TBD * - * @param array $form The form object. - * @param int $entry_id The entry ID. + * @param array $form The form object. + * @param int $entry_id The entry ID. + * @param GravityView_Edit_Entry_Render $edit_entry_render The edit entry render class instance. */ public function trigger_notifications( $form, $entry_id, $edit_entry_render ) { GravityView_Notifications::send_notifications( (int) $entry_id, 'gravityview/edit_entry/after_update', $edit_entry_render->entry ); } /** - * Add the edit notification event. + * Adds the notification event. * * @since TBD * - * @param array $notification_events Existing notification events. - * @param array $form The form object. + * @param array $notification_events Existing notification events. + * @param array $form The form object. * * @return array */ - public function add_edit_notification_events( $notification_events = array(), $form = array() ) { + public function add_edit_notification_events( $notification_events = [], $form = [] ) { $notification_events['gravityview/edit_entry/after_update'] = 'GravityView - ' . esc_html_x( 'Entry is updated', 'The title for an event in a notifications drop down list.', 'gk-gravityview' ); + return $notification_events; } +} -} // end class - -// add_action( 'plugins_loaded', array('GravityView_Edit_Entry', 'getInstance'), 6 ); GravityView_Edit_Entry::getInstance(); From 3bb9b0752fe3f8d1ccb0cf51ac42dcb33a2e8232 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 20 Nov 2024 09:25:03 -0500 Subject: [PATCH 15/18] Update changelog [ci skip] --- readme.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.txt b/readme.txt index f72ddf8cd7..a1c909b075 100644 --- a/readme.txt +++ b/readme.txt @@ -23,6 +23,8 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h = develop = +Added: New form notification event triggered when an entry is updated. + __Developer Updates:__ * Added `gk/gravityview/view/entries/join-conditions` filter to modify the join conditions applied during the retrieval of View entries. * Added: `gk/gravityview/template/options` filter to allow programmatically modifying Field settings in the View editor. From d6bfd6fca19d96495bb65d543522bd0dc6ce14b6 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 20 Nov 2024 16:53:06 -0500 Subject: [PATCH 16/18] Bump version to 2.32 & update changelog --- future/includes/class-gv-view.php | 2 +- gravityview.php | 4 +- includes/admin/class.render.settings.php | 8 +-- includes/class-admin-welcome.php | 68 ++++++++----------- .../edit-entry/class-edit-entry.php | 4 +- readme.txt | 20 ++++-- 6 files changed, 53 insertions(+), 53 deletions(-) diff --git a/future/includes/class-gv-view.php b/future/includes/class-gv-view.php index ac8c7ca7c3..b3c330030d 100644 --- a/future/includes/class-gv-view.php +++ b/future/includes/class-gv-view.php @@ -1258,7 +1258,7 @@ public function get_entries( $request = null ) { * * @filter `gk/gravityview/view/entries/join-conditions` * - * @since $ver$ + * @since 2.32.0 * * @param GF_Query_Condition $status_conditions The GF_Query_Condition instance. * @param Join $join The Join instance. diff --git a/gravityview.php b/gravityview.php index 60f3294807..d4632e39d3 100644 --- a/gravityview.php +++ b/gravityview.php @@ -3,7 +3,7 @@ * Plugin Name: GravityView * Plugin URI: https://www.gravitykit.com * Description: The best, easiest way to display Gravity Forms entries on your website. - * Version: 2.31.1 + * Version: 2.32 * Requires PHP: 7.4.0 * Author: GravityKit * Author URI: https://www.gravitykit.com @@ -32,7 +32,7 @@ /** * The plugin version. */ -define( 'GV_PLUGIN_VERSION', '2.31.1' ); +define( 'GV_PLUGIN_VERSION', '2.32' ); /** * Full path to the GravityView file diff --git a/includes/admin/class.render.settings.php b/includes/admin/class.render.settings.php index fe8f1ac857..b578803014 100644 --- a/includes/admin/class.render.settings.php +++ b/includes/admin/class.render.settings.php @@ -18,7 +18,7 @@ class GravityView_Render_Settings { /** * Registers required filter hooks. * - * @since $ver$ + * @since 2.32.0 */ public static function register_hooks(): void { // Filter is applied with priority 500 to act later in the process. It is very likely this filter will be @@ -34,7 +34,7 @@ public static function register_hooks(): void { /** * Adds general field options. * - * @since $ver$ + * @since 2.32.0 * * @param array $field_options The field options. * @param 'widget'|'field' $field_type The field type. @@ -84,7 +84,7 @@ public function __construct() { /** * Sorts the field options. * - * @since $ver$ + * @since 2.32.0 * * @param array $field_options The field options. * @param 'widget'|'field' $field_type The field type. @@ -276,7 +276,7 @@ public static function get_default_field_options( $field_type, $template_id, $fi /** * Filters the field options. * - * @since $ver$ + * @since 2.32.0 * * @filter `gravityview_template_{$input_type}_options` * diff --git a/includes/class-admin-welcome.php b/includes/class-admin-welcome.php index 4dd9778739..7034546de4 100644 --- a/includes/class-admin-welcome.php +++ b/includes/class-admin-welcome.php @@ -296,6 +296,35 @@ public function changelog_screen() { * - If 4.28, include to 4.26. */ ?> +

    2.32 on November 20, 2024

    + +

    This release adds a new form notification option for updated entries, resolves file upload issues on the Edit Entry screen, and includes developer-focused enhancements.

    + +

    🚀 Added

    + +
      +
    • New notification option for forms, triggered when an entry is updated.
    • +
    + +

    🐛 Fixed

    + +
      +
    • File upload field issues on the Edit Entry screen: +
        +
      • Delete/download icons not displaying in Gravity Forms 2.9+;
      • +
      • Unable to select files for upload when the form field's "Multiple Files" setting was enabled without a "Maximum Number of Files" value.
      • +
      +
    • +
    + +

    💻 Developer Updates

    + +
      +
    • Added gk/gravityview/view/entries/join-conditions filter to modify the join conditions applied when retrieving View entries.
    • +
    • Added gk/gravityview/template/options filter to programmatically modify field settings in the View editor.
    • +
    • Added gravityview/row-added JavaScript event, triggered when a new row is added to a widget or field area.
    • +
    +

    2.31.1 on November 8, 2024

    This hotfix release resolves display issues with certain View layouts.

    @@ -398,45 +427,6 @@ public function changelog_screen() {
  • Foundation to version 1.2.19.
  • -

    2.29 on October 1, 2024

    - -

    This release introduces a much-requested lightbox feature for displaying and editing entries, settings for customizing View URLs, new options for displaying Name field initials and Custom Content fields in full width, and a merge tag modifier to show date field values in a human-readable format. Several bugs have also been fixed.

    - -

    🚀 Added

    - -
      -
    • Ability to edit and display entries inside a lightbox.
    • -
    • Global and individual View settings to customize the URL structure for all or specific Views.
    • -
    • :human merge tag modifier for date fields to display in human-readable format (e.g., 10 minutes ago, 5 days from now).
    • -
    • Option to display the Name field value as initials.
    • -
    • Option to display Custom Content field full width on the Single Entry screen.
    • -
    - -

    🐛 Fixed

    - -
      -
    • Clearing search removed all URL query parameters and, in some cases, redirected to the homepage.
    • -
    • Searching the View added duplicate search parameters to the URL.
    • -
    • PHP 8.2 deprecation notice related to dynamic property creation.
    • -
    • Entries not displaying when a View using DataTables was embedded in a Single Entry page with the List layout.
    • -
    • PHP warning when displaying a View with an Event field without an active Gravity Forms Event Fields Add-On.
    • -
    • Sorting entries in random order was not working.
    • -
    • Multi Select field values starting with a square bracket were not displayed as selected on the Edit Entry screen.
    • -
    - -

    🔧 Updated

    - - - -

    💻 Developer Updates

    - -
      -
    • Added gk/gravityview/field/name/display filter to modify the Name field display value.
    • -
    • Added gk/gravityview/permalinks/reserved-terms filter to modify the list of reserved terms that are excluded from permalinks.
    • -
    -

    diff --git a/includes/extensions/edit-entry/class-edit-entry.php b/includes/extensions/edit-entry/class-edit-entry.php index 3d6b2c322d..7c531a4f76 100644 --- a/includes/extensions/edit-entry/class-edit-entry.php +++ b/includes/extensions/edit-entry/class-edit-entry.php @@ -463,7 +463,7 @@ function ( $caps ) { /** * Triggers notifications. * - * @since TBD + * @since 2.32.0 * * @param array $form The form object. * @param int $entry_id The entry ID. @@ -476,7 +476,7 @@ public function trigger_notifications( $form, $entry_id, $edit_entry_render ) { /** * Adds the notification event. * - * @since TBD + * @since 2.32.0 * * @param array $notification_events Existing notification events. * @param array $form The form object. diff --git a/readme.txt b/readme.txt index a1c909b075..d589f15ea4 100644 --- a/readme.txt +++ b/readme.txt @@ -23,12 +23,22 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h = develop = -Added: New form notification event triggered when an entry is updated. += 2.32 on November 20, 2024 = -__Developer Updates:__ -* Added `gk/gravityview/view/entries/join-conditions` filter to modify the join conditions applied during the retrieval of View entries. -* Added: `gk/gravityview/template/options` filter to allow programmatically modifying Field settings in the View editor. -* Added: `gravityview/row-added` JavaScript event when a new row is added to a Widget/Field area. +This release adds a new form notification option for updated entries, resolves file upload issues on the Edit Entry screen, and includes developer-focused enhancements. + +#### 🚀 Added +* New notification option for forms, triggered when an entry is updated. + +#### 🐛 Fixed +* File upload field issues on the Edit Entry screen: + - Delete/download icons not displaying in Gravity Forms 2.9+; + - Unable to select files for upload when the form field's "Multiple Files" setting was enabled without a "Maximum Number of Files" value. + +#### 💻 Developer Updates +* Added `gk/gravityview/view/entries/join-conditions` filter to modify the join conditions applied when retrieving View entries. +* Added `gk/gravityview/template/options` filter to programmatically modify field settings in the View editor. +* Added `gravityview/row-added` JavaScript event, triggered when a new row is added to a widget or field area. = 2.31.1 on November 8, 2024 = From b57f9b304edcb671beda2a828b579fdb35d8f0a6 Mon Sep 17 00:00:00 2001 From: Vlad Date: Thu, 21 Nov 2024 09:03:10 -0500 Subject: [PATCH 17/18] Update release date [ci skip] --- includes/class-admin-welcome.php | 2 +- readme.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-admin-welcome.php b/includes/class-admin-welcome.php index 7034546de4..2263b6c4ad 100644 --- a/includes/class-admin-welcome.php +++ b/includes/class-admin-welcome.php @@ -296,7 +296,7 @@ public function changelog_screen() { * - If 4.28, include to 4.26. */ ?> -

    2.32 on November 20, 2024

    +

    2.32 on November 21, 2024

    This release adds a new form notification option for updated entries, resolves file upload issues on the Edit Entry screen, and includes developer-focused enhancements.

    diff --git a/readme.txt b/readme.txt index d589f15ea4..408c9217a0 100644 --- a/readme.txt +++ b/readme.txt @@ -23,7 +23,7 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h = develop = -= 2.32 on November 20, 2024 = += 2.32 on November 21, 2024 = This release adds a new form notification option for updated entries, resolves file upload issues on the Edit Entry screen, and includes developer-focused enhancements. From 136e759f0f49a2318a9b6e4ab745987fd7bfda7b Mon Sep 17 00:00:00 2001 From: Vlad Date: Thu, 21 Nov 2024 11:31:28 -0500 Subject: [PATCH 18/18] Explicitly cast max_files to an integer [ci skip] --- assets/js/fe-views.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/fe-views.js b/assets/js/fe-views.js index b5167313b4..440e652032 100644 --- a/assets/js/fe-views.js +++ b/assets/js/fe-views.js @@ -65,7 +65,7 @@ jQuery( function ( $ ) { $.each(gfMultiFileUploader.uploaders, function(index, uploader){ uploader.bind('Init', function(up, params) { var data = up.settings; - var max = data.gf_vars.max_files; + var max = parseInt(data.gf_vars.max_files, 10); if(max === 0){ return; } @@ -77,7 +77,7 @@ jQuery( function ( $ ) { uploader.bind('FilesAdded', function(up, files) { var data = up.settings; - var max = data.gf_vars.max_files; + var max = parseInt(data.gf_vars.max_files, 10); if(max === 0){ return; }