Custom submit handler: how to create node? I created a form_node_alter for a content type called "banner" and I made a custom submit handler named "mymodule_check_submit_handler()".
Everything is ok, I can do what I want in the submit handler function but I don't know how to create the node of type "banner" once I executed my custom code.

Searching for a solution I found this code:

$values = $form_state-&gt;getValues();
$node = entity_create('node', $values);
$node-&gt;save();


But now I got this error: Error: Call to a member function getValues() on array in mymodule_check_submit_handler() 

How can I create the node in my custom submit handler?
After some searches I post the solution to myself!

This is the right code to use:

$values = $form_state['values'];
$node = entity_create('node', $values);
$node = node_submit($node); // Prepare node for saving
node_save($node);