Hi @manelguillenp,
Sorry for the late response. This ticket slipped by me.
It is possible, but it does take some work. Your best option is to overwrite the FileUploadField
transformer with a custom implementation. Something like this should do the trick:
class FileNameUploadField extends \GFExcel\Field\FileUploadField
{
// Duplicate the field paths to another cell and only return the base name.
public function getCells($entry)
{
if ($cells = parent::getCells($entry)) {
$base_name = implode(' , ', array_map('basename', explode(' , ', $cells[0])));
$cells = array_merge($cells, $this->wrap([$base_name]));
}
return $cells;
}
// Add another cell that only contains the filename. Will have the same name with <code>(filename)</code> attached to the label.
public function getColumns()
{
if ($columns = parent::getColumns()) {
$columns = array_merge($columns, $this->wrap([$columns[0] . ' (filename)'], true));
}
return $columns;
}
}
// Replace the regular fileupload transformer with the custom implementation.
add_filter('gfexcel_transformer_fields', function (array $fields) {
$fields['fileupload'] = FileNameUploadField::class;
return $fields;
});
I would recommend storing the class in a separate file and include that inside your functions.php
.
Hope this helps you out. Let me know if it did, or if you need any help!