From 337c11b94a7c5771e5e377e961374c5d98710545 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 14 Oct 2024 16:37:11 -0400 Subject: [PATCH] Fix PHP notice when rendering entry value from inactive add-on --- future/includes/class-gv-template-field.php | 7 +++++++ includes/class-admin-welcome.php | 1 + readme.txt | 1 + 3 files changed, 9 insertions(+) diff --git a/future/includes/class-gv-template-field.php b/future/includes/class-gv-template-field.php index 04ee7b4dd2..835770915d 100644 --- a/future/includes/class-gv-template-field.php +++ b/future/includes/class-gv-template-field.php @@ -287,6 +287,13 @@ public function render() { /** Prevent any PHP warnings that may be generated. */ ob_start(); + // The base GF_Field::get_value_entry_detail() method accepts a string value and needs to be overridden to handle arrays. + // If it's an array, we need to convert it to a string to prevent a PHP notice generated by GF_Field::get_value_entry_detail(). + // This occurs when rendering an entry value for a custom field from an inactive add-on that would otherwise handle the array. + if ( is_array( $value ) && 'GF_Field' === get_class( $this->field->field ) ) { + $value = implode( ', ', array_filter( $value ) ); + } + $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $entry['currency'], false, 'html' ); if ( $errors = ob_get_clean() ) { diff --git a/includes/class-admin-welcome.php b/includes/class-admin-welcome.php index a0f232649b..2e83ede1db 100644 --- a/includes/class-admin-welcome.php +++ b/includes/class-admin-welcome.php @@ -322,6 +322,7 @@ public function changelog_screen() {
  • Fatal error when rendering a GravityView View field with a non-existent View ID.
  • Survey field (Rating type) values were displayed in reverse order when a View was embedded inside another View.
  • Unexpected scrolling in the View editor after adding a field.
  • +
  • PHP notice when rendering a View with a field associated with an inactive add-on.
  • 🔧 Updated

    diff --git a/readme.txt b/readme.txt index 550d43bb42..d27d943e4a 100644 --- a/readme.txt +++ b/readme.txt @@ -39,6 +39,7 @@ This release adds the ability to change the entry creator from the Edit Entry sc * Fatal error when rendering a GravityView View field with a non-existent View ID. * Survey field (Rating type) values were displayed in reverse order when a View was embedded inside another View. * Unexpected scrolling in the View editor after adding a field. +* PHP notice when rendering a View with a field associated with an inactive add-on. #### 🔧 Updated * [Foundation](https://www.gravitykit.com/foundation/) to version 1.2.19.