Skip to content

Commit

Permalink
Fix PHP notice when rendering entry value from inactive add-on
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcasual committed Oct 14, 2024
1 parent e98337e commit 337c11b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions future/includes/class-gv-template-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) {
Expand Down
1 change: 1 addition & 0 deletions includes/class-admin-welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ public function changelog_screen() {
<li>Fatal error when rendering a GravityView View field with a non-existent View ID.</li>
<li>Survey field (Rating type) values were displayed in reverse order when a View was embedded inside another View.</li>
<li>Unexpected scrolling in the View editor after adding a field.</li>
<li>PHP notice when rendering a View with a field associated with an inactive add-on.</li>
</ul>

<h4>🔧 Updated</h4>
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 337c11b

Please sign in to comment.