Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue #582 with exterannous error message appearing in FieldtypeF…
…ile.
- Loading branch information
1 parent
9264a53
commit c1dd1b3
Showing
1 changed file
with
12 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c1dd1b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Ryan - I think this is definitely an improvement, but I am worried that as a message, rather than a warning, I don't think people will see it. If you don't see it and proceed to add it to a template, and then edit a page with that template, you end up with the good old " FieldtypeImage: Field "newimage" is not yet ready to use and needs to be configured." error. If you go back to the field settings that same error shows again, which comes back to the same problem - what do I need to do to configure it :) and, if I save the field again at this point, the error still shows - so it still needs two saves to dismiss it.
It's a shame the default config can't be saved automatically.
Perhaps one improvement would be for the first message to be a warning - would you consider adding a new "warning" type to PW that was amber/orange. I think this would still get people's attention that something needs to be done, but without being a real error in this case. I know I have thought that would be useful in some of my modules.
Thanks!
c1dd1b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have warnings, just messages and errors (someday we'll have to add warnings). Messages are meant to be informational or help you along, and that's what this is. If the user goes and tries to put content in the field before they've completed the field configuration, then at that point it's an error. I would consider an un-configured files field unsafe to use, so that's why I'm not comfortable with just falling back to defaults when they don't configure it. The same goes for plenty of other Fieldtypes too, though the safety issue doesn't have the same gravity, so less of a concern elsewhere.
I couldn't reproduce the issue you mentioned of having to save the field two times after creating it. I could reproduce that one before today, but not after this fix. The reason it was showing a second time is just because the check was done before the settings were saved. Combined with a 2x page load (save + redirect), it would appear twice. That's what I fixed. If it's still still saying "review and save" (or the unconfigured error in the page editor) even after you have already seen that message and followed the instruction, then we probably need to look at what's different about your system. I've got quite a few updates in progress, so it's always possible I've forgotten to push some file to GitHub.
c1dd1b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we don't have warnings - that's why I suggested it ;) - I think it would be very useful, especially in this case because I honestly don't think anyone will read the message and know they have to save it again. I know I often ignore anything in green!
Did you follow my exact steps? The double save is only an issue if you end up with the warning after adding to template and trying to edit a page. I don't ever see the "review and save" message twice, but the unconfigured error definitely shows twice and is still not very helpful as to what you need to do to fix it. I know it is obvious to us, but I think someone new needs to see the "review and save" again if they follow these same steps, having missed the message the first time. Make sense?
Or maybe it is something you haven't committed yet?
c1dd1b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still seeing this warning. What is it? I am creating image fields via api, and saving twice via api does not make it disappear, but saving the field in admin does.
c1dd1b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't done this in a while, but previously the only way around this for me via the API has been:
If you also enable tags, I found I had to:
This is the combo I am using in Migrator and seems to work great.