Skip to content

Commit

Permalink
Merge pull request #185 from GravityKit/hotfix/broken-value-objects
Browse files Browse the repository at this point in the history
fix invalid type for callback
  • Loading branch information
mrcasual authored Mar 8, 2024
2 parents bbc16f3 + 55dfa07 commit 58f4623
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ You can hide a row by adding a hook. Checkout this example:

* Enhancement: Added security by requiring a secret for embedding the download link shortcode
* Enhancement: Added embed shortcode copy section
* Bugfix: Nested forms with missing entries could create a critical issue.

= 2.1.0 on September 25, 2023 =

Expand Down
12 changes: 9 additions & 3 deletions src/Transformer/Combiner.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace GFExcel\Transformer;

use GF_Field;
use GFExcel\Field\FieldInterface;
use GFExcel\Field\RowsInterface;
use GFExcel\Values\BaseValue;
Expand Down Expand Up @@ -59,8 +60,11 @@ public function parseEntry( array $fields, array $entry ): void {
continue;
}

// Multiple rows, so we need to combine, and we MUST have a StringValue object.
$combined = array_reduce( $values, static function ( string $output, BaseValue $value ): string {
$combined = array_reduce( $values, static function ( string $output, ?BaseValue $value ): string {
if ( ! $value ) {
return $output;
}

if ( $output !== '' ) {
$output .= gf_apply_filters( [
'gfexcel_combiner_glue',
Expand All @@ -74,7 +78,9 @@ public function parseEntry( array $fields, array $entry ): void {
return $output;
}, '' );

$combined_row[ $column ] = new StringValue( $combined, reset( $values )->getField() );
$gf_field = array_filter( $values ) ? reset( $values )->getField() : new GF_Field();

$combined_row[ $column ] = new StringValue( $combined, $gf_field );
}

$this->rows[] = $combined_row;
Expand Down

0 comments on commit 58f4623

Please sign in to comment.