File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class PageTotalsRow implements PartInterface, ViewComponentInterface
3939 ];
4040
4141 /**
42- * Keys are column id's and values are operations (see PageTotalsRow::OPERATION_* constants).
42+ * Keys are column id's and values are operations (PageTotalsRow::OPERATION_* constants or closures ).
4343 *
4444 * @var string[]|array
4545 */
@@ -133,18 +133,19 @@ public function render()
133133 $ lastRow = $ grid ->getCurrentRow ();
134134 $ grid ->setCurrentRow ($ this ->totalData );
135135
136- // modify columns
136+ // modify columns, prepare it for rendering totals row
137137 $ valueCalculators = [];
138138 $ valueFormatters = [];
139139 foreach ($ grid ->getColumns () as $ column ) {
140140 $ valueCalculators [$ column ->getId ()] = $ column ->getValueCalculator ();
141141 $ valueFormatters [$ column ->getId ()] = $ prevFormatter = $ column ->getValueFormatter ();
142142 $ column ->setValueCalculator (null );
143143 $ column ->setValueFormatter (function ($ value ) use ($ prevFormatter , $ column ) {
144- if ($ prevFormatter ) {
144+ $ operation = $ this ->getOperation ($ column ->getId ());
145+ if ($ prevFormatter && !($ operation === static ::OPERATION_IGNORE || $ operation instanceof Closure)) {
145146 $ value = call_user_func ($ prevFormatter , $ value );
146147 }
147- $ operation = $ this -> getOperation ( $ column -> getId ());
148+ // Add value prefix if specified for operation
148149 if ($ value !== null && is_string ($ operation ) && array_key_exists ($ operation , $ this ->valuePrefixes )) {
149150 $ value = $ this ->valuePrefixes [$ operation ] . ' ' . $ value ;
150151 }
You can’t perform that action at this time.
0 commit comments