I'd like to be able to create feed nodes in advance, before I have the feed file to upload.
However, this is not possible because the validation in feedapi_node_validate doesn't allow this.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | feedapi_node_validate.patch | 2.63 KB | b-prod |
| #5 | feedapi.patch | 3.52 KB | b-prod |
Comments
Comment #1
aron novakCorrect me, if i'm wrong, but in general, feedapi happily creates feed nodes w/ invalid URL as long as you supply the feed node title.
It should be true for file:// pathes as well.
edit: maybe w/ file://, it's a little bit different compared to the file upload form, but maybe it's still an option
Comment #2
alex_b commentedConceptually, there is no reason why it shouldn't be possible to create feed nodes without specifying the URL. Killes: where exactly does feedapi_node_validate() complain?
Alex
Comment #3
killes@www.drop.org commentedIt complains if I didn't enter a feed and did not upload a file:
Comment #4
alex_b commented#3: Sorry, should have read this out of the code myself. I was too sure that we were allowing this.
IMO, we could remove this check. We will have to make sure that refreshing does fail graciously though.
Aron - thoughts?
Comment #5
b-prod commentedThis patch add a settings option in node type edit form. So it is possible to choose if the feed URL or uploaded file is mandatory (default behavior) for saving a feed node.
In case of these fields are not required, it take care of the node title (it cannot be retrieved from unexisting file) and displays an error if title is empty.
For URL field, the standard form API handling is used for an empty field. For file upload field, it is not possible because of a well-known bug in Drupal file field handler.
Comment #6
alex_b commentedI would suggest to try to use FormAPI.
- As the behavior up to now has been that a URL is required, let's add a '#required' = TRUE flag to the URL field.
- Remove the manual validation step from feedapi_node_validate()
- If a non-required behavior is desired, it can be removed via form_alter() in a custom module.
This would a) bring this behavior in line with what Drupal API users would expect b) does not crowd our UI with a setting for corner cases.
I would love to hear Aron's opinion on this, because I'm thinking there is a reason for why the the FormAPI #required property isn't being used.
Comment #7
aron novakAt the simplified feed create form, the URL is ensured via #required, so i'm pretty sure there is no serious reason against using #required => TRUE. The #6 just makes sense not to alter the behaviour, but allowing to override it.
Comment #8
gerhard killesreiter commentedthe problem with that approach is that I'll then need to override the entire validation function in my custom module. I wanted to avoid that.
Also, you already add the upload form though hook_form_alter so a potential custom module needs to take weights into account. This is getting messy...
Comment #9
b-prod commentedFor information: the bug is known and described here.
Comment #10
alex_b commented#9: good find. Thank you for digging this up.
Seems like the variable is the way to go. NR again. Will review as soon as possible.
Comment #11
b-prod commentedHere is an updated patch for the dev version which has changed since the first patch.
Comment #12
adub commentedI'm working on a services client parser module which will form_alter this field into a select box with non-url values - not sure if this could affect that kind of functionality.