Created
June 26, 2012 06:32
-
-
Save cafuego/2993779 to your computer and use it in GitHub Desktop.
static flag to avoid loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wibble_node_presave($node) { | |
if (node->type == 'whatever') { | |
static $edit_flag; | |
if (reference_has_changed && empty($edit_flag)) { | |
$edit_flag = TRUE; | |
$reference = node_load($node->reference_field[0]['nid']); | |
$reference->reference_field[0]['nid'] = node->nid; | |
node_save($reference); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment