Skip to main content
added 437 characters in body
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Looking at the code of node_save(), which the function used to save a node, the hooks that are invoked after drupal_write_record(), which is the function used to set the node ID, are the following ones (when the node is created):

// Call the node specific callback (if any). This can be
// node_invoke($node, 'insert') or
// node_invoke($node, 'update').
node_invoke($node, $op);

// Save fields.
$function = "field_attach_$op";
$function('node', $node);

module_invoke_all('node_' . $op, $node);
module_invoke_all('entity_' . $op, $node, 'node');

 

Can I access the hook_form_alter() as the content is created (on form submission)?

hook_form_alter() is invoked for a node edit form whenever the node is being created, or the node is being updated. You can add a custom submission handler from hook_form_alter(), which then is able to alter the node being saved.
The hooks I have reported should be sufficient for what you want to do, though.

Looking at the code of node_save(), which the function used to save a node, the hooks that are invoked after drupal_write_record(), which is the function used to set the node ID, are the following ones (when the node is created):

// Call the node specific callback (if any). This can be
// node_invoke($node, 'insert') or
// node_invoke($node, 'update').
node_invoke($node, $op);

// Save fields.
$function = "field_attach_$op";
$function('node', $node);

module_invoke_all('node_' . $op, $node);
module_invoke_all('entity_' . $op, $node, 'node');

Looking at the code of node_save(), which the function used to save a node, the hooks that are invoked after drupal_write_record(), which is the function used to set the node ID, are the following ones (when the node is created):

// Call the node specific callback (if any). This can be
// node_invoke($node, 'insert') or
// node_invoke($node, 'update').
node_invoke($node, $op);

// Save fields.
$function = "field_attach_$op";
$function('node', $node);

module_invoke_all('node_' . $op, $node);
module_invoke_all('entity_' . $op, $node, 'node');

 

Can I access the hook_form_alter() as the content is created (on form submission)?

hook_form_alter() is invoked for a node edit form whenever the node is being created, or the node is being updated. You can add a custom submission handler from hook_form_alter(), which then is able to alter the node being saved.
The hooks I have reported should be sufficient for what you want to do, though.

Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Looking at the code of node_save(), which the function used to save a node, the hooks that are invoked after drupal_write_record(), which is the function used to set the node ID, are the following ones (when the node is created):

// Call the node specific callback (if any). This can be
// node_invoke($node, 'insert') or
// node_invoke($node, 'update').
node_invoke($node, $op);

// Save fields.
$function = "field_attach_$op";
$function('node', $node);

module_invoke_all('node_' . $op, $node);
module_invoke_all('entity_' . $op, $node, 'node');