Example #1
0
/**
 * Alter the node before saving a clone.
 *
 * @param $node
 *   Reference to the fully loaded node object being saved (the clone) that
 *   can be altered as needed.
 * @param array $context
 *   An array of context describing the clone operation. The keys are:
 *   - 'method' : Can be either 'prepopulate' or 'save-edit'.
 *   - 'original_node' : The original fully loaded node object being cloned.
 *
 * @see clone_node_save()
 * @see drupal_alter()
 */
function hook_clone_node_alter(&$node, $context)
{
    if ($context['original_node']->type == 'special') {
        $node->special = special_something();
    }
}
Example #2
0
/**
 * Alter the node before saving a clone.
 *
 * @param $node
 *   Reference to the fully loaded node object being saved (the clone) that
 *   can be altered as needed.
 * @param $original_node
 *   A copy of the fully loaded node object being cloned (the original).
 * @param $method
 *   The cloning method which can be either 'prepopulate' or 'save-edit'.
 *
 * @see clone_node_save()
 * @see drupal_alter()
 */
function hook_clone_node_alter(&$node, $original_node, $method)
{
    if ($original_node->type = 'special') {
        $node->special = special_something();
    }
}