When using title replacement, and saving a node there is a message "Could not retrieve title from feed". Title module actually hides the title form element, and adds a field replacement for it. So there is no value for the node title property on hook_node_validate, when the field replacement is properly populated.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | feeds-title-module-support-2645074-4.patch | 778 bytes | megachriz |
Comments
Comment #2
megachrizIs there a way to detect if the title form element is available in
feeds_node_validate()instead of checking if the title module is enabled?See also this related issue: #1621602: Could not retrieve title from feed - Make title field only optional if the parser can deliver a title.
That issue is about making the title field only non-required if the selected parser can provide a title. The CSV parser cannot.
Comment #3
miroslavbanov commentedThere is a way to check for form element.
Better yet check if title field is on the node:
OR using title field API:
Comment #4
megachrizIt is recommended to try to avoid writing special case solutions (like checking if module x is available) in a module whenever possible. The module code could get bloated with things like "If module x is available, do this. But if module y is also available and module z is not, do this."
Instead, the attached patch checks if the default title form element is hidden. If so, it doesn't try to retrieve a title from the source and as a result no error will be triggered for this element.
Comment #6
megachrizCommitted #4.