Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly merge the file field configuration #33

Merged
merged 2 commits into from
Dec 28, 2015

Conversation

flaviocopes
Copy link
Contributor

Currently it picks the settings in the wrong way, and even after fixing
it, it merges the config (adding multiple and destination as arrays, so
the code following will break as it assumes those are strings). The new
code replaces the default values with the array values set in the field.

Currently it picks the settings in the wrong way, and even after fixing
it, it merges the config (adding multiple and destination as arrays, so
the code following will break as it assumes those are strings). The new
code replaces the default values with the array values set in the field.
@w00fz
Copy link
Member

w00fz commented Dec 25, 2015

What about the file and route props that are now lost in the cleanFile?

@w00fz
Copy link
Member

w00fz commented Dec 25, 2015

I'm actually not sure this will work. Isn't all the file data going to get lost? Seems like the only data available then will become the $path but what about the name, size, etc?

@flaviocopes
Copy link
Contributor Author

That part is still not 100% clear to me. Is that information actually needed? For example in the admin part I just save the filename, since that's "the" useful information, while I ignore the rest.

In the frontend we can still save all, but for example in a "save" action it's saved as

file: {"user\/data\/files\/test.txt":{"name":"test.txt","type":"text\/plain","size":4,"file":"user\/data\/files\/test.txt","route":null}}

Ideally, I'd just like a list of files. Now I get

file: ["user\/data\/files\/test.txt"]

But I still don't like it, for example I'd like

file: '/user/data/files/test.txt'

or

files: 
  - '/user/data/files/test.txt'
  - '/user/data/files/another.txt'

@flaviocopes
Copy link
Contributor Author

It's also fine to get all the information, if there's a use-case for that, but I need to find a way to save it properly organized

@flaviocopes
Copy link
Contributor Author

Restored that part, since it's not in the topic of this PR anyway. The goal was to fix saving the file after testing for this bug report http://getgrav.org/forum#!/getgrav/plugin-development:form-plugin-mime-type-trou

flaviocopes added a commit that referenced this pull request Dec 28, 2015
Correctly merge the file field configuration
@flaviocopes flaviocopes merged commit d45a156 into develop Dec 28, 2015
@flaviocopes flaviocopes deleted the feature/fix-file-input branch December 28, 2015 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants