Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Update FileUpload.php #358

Open
wants to merge 1 commit into
base: 8.x-2.x
Choose a base branch
from
Open

Conversation

luisvivasb
Copy link

The $file->setPermanent() is already call when you use the file in media entity. If you call this function at this point you can't use tokens or filefield_paths to manipulate the image name and folder to be saved.

#357 You can see the problem with filefield_paths

The $file->setPermanent() is already call when you use the file in media entity. If you call this function at this point you can't use tokens or filefield_paths to manipulate the image name and folder to be saved.
Copy link
Collaborator

@phenaproxima phenaproxima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks useful, but needs a bit of refinement...

@@ -104,8 +104,8 @@ public function submit(array &$element, array &$form, FormStateInterface $form_s
$entity,
MediaHelper::getSourceField($entity)->entity
);
$file->setPermanent();
$file->save();
//$file->setPermanent();
Copy link
Collaborator

@phenaproxima phenaproxima May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't merge this with unexplained, commented-out code in there. If this makes it work (and apparently it still passes the tests, so hey, alright!), then we need a comment here explaining why the file is not saved.

@phenaproxima
Copy link
Collaborator

phenaproxima commented May 10, 2017

This looks like a nice win. I think we're going to need a test of it, though. That's going to be fairly involved, since we'll likely have to write a few new Behat step definitions. I can probably open a feature branch and work on this there, if you'd prefer. Because I'd definitely like to get this committed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants