1

I want to know if a node object could pass the form submit. With the UI, if required fields are missing, you can't save the node.

I would like to load the node object programmaticly, and check if all required fields are set. Is there a easy way to check that ?

2

Passing form submit means passing the form's validate handlers. Once validation is passed, the node is written into database and no more validation will be done(not sure about this). That's why node_save api function does not return anything.

It means that "Required" fields are to be validated only in the Form validator. You can however choose to even write a Node without "Required" fields filled in. For example to can choose to empty "Required" fields in hook_presave(D7).

node_load does not check if all fields are set or not. It simply creates a node object which is consistent and also calls various hooks. It saves us from portability issues if we were to write our own functions to read the database and build node object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.