Skip to content

[Bug] Dropzone withFiles fluent syntax doesn't populate fileNamer key on $this->crud->fields() #5791

@kde99

Description

@kde99

Bug report

What I did

CRUD::field("mellekletek")->type("dropzone")->withFiles([
            "path" => "ticketek/" . date("Y/m"),
            "fileNamer" => function ($file, $uploader) {
                dd($file, $uploader);
            }
        ])->label("Mellékletek");

Dropzone defined with fluent syntax like in the docs.

What I expected to happen

The file namer to be called and used.

What happened

File namer is ignored all together.

What I've already tried to fix it

I digged deeper. Backpack\Pro\Http\Controllers\Operations\DropzoneOperation#73 uses $this->crud->fields()[$fieldName]['withFiles'], if you set a breakpoint there and check the values in $this->crud->fields(), you will see that the dropzone defined using the fluent syntax will be missing the "withFiles" key.
image

Now if I do the "old" way, you can see it being populated and the filer namer be used correctly:
image

Is it a bug in the latest version of Backpack? YES

After I run composer update backpack/crud the bug... is it still there? Yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

8.3.8

PHP EXTENSIONS:

Core, bcmath, calendar, ctype, date, filter, hash, iconv, json, SPL, pcre, random, readline, Reflection, session, standard, mysqlnd, tokenizer, zlib, libxml, dom, PDO, openssl, SimpleXML, xml, xmlreader, xmlwriter, curl, ftp, fileinfo, gd, gettext, intl, imap, mbstring, exif, mysqli, Phar, pdo_mysql, pdo_pgsql, pdo_sqlite, soap, sockets, sqlite3, tidy, xsl, zip, mongodb, redis, xdebug

LARAVEL VERSION:

12.3.0.0

BACKPACK PACKAGE VERSIONS:

backpack/activity-log: 2.0.6
backpack/basset: 1.3.7
backpack/crud: 6.8.0
backpack/devtools: 3.1.7
backpack/generators: v4.0.7
backpack/pro: 2.2.32
backpack/theme-tabler: 1.2.17

Additional Information

Here's some more info that could be helpful in reproducing or debugging:
See above.

Note: Issues that cannot be reproduced or lack necessary details to diagnose could be closed.

Metadata

Metadata

Assignees

Type

Projects

Status

No status

Status

No status

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions