/** * {@inheritdoc} */ public function convertToExportFormat(array $exportedRecord, $skipNullValues = true) { if ($this->context->getValue('columns')) { $columns = $this->context->getValue('columns'); } elseif ($this->context->hasOption('gridName')) { $gridName = $this->context->getOption('gridName'); $gridConfig = $this->gridManagerLink->getService()->getConfigurationForGrid($gridName); $columns = $gridConfig->offsetGet('columns'); } else { throw new InvalidConfigurationException('Configuration of datagrid export processor must contain "gridName" or "columns" options.'); } if ($this->context->hasOption('gridParameters')) { $gridParams = $this->context->getOption('gridParameters'); if ($gridParams->has(ColumnsExtension::COLUMNS_PARAM)) { $columnsParams = $gridParams->get(ColumnsExtension::COLUMNS_PARAM); $columns = $this->columnsHelper->reorderColumns($columns, $columnsParams); } } $result = []; foreach ($columns as $columnName => $column) { if (isset($column['renderable']) && false === $column['renderable']) { continue; } $val = isset($exportedRecord[$columnName]) ? $exportedRecord[$columnName] : null; $val = $this->applyFrontendFormatting($val, $column); $result[$this->translator->trans($column['label'])] = $val; } return $result; }