Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By mattyb on
Hi
I'm using the compute field to generate an api key, only I don't want it to re-run the script every time I save the page, only on insert.
I'm not sure what approach I should take.
Thanks in advance
Matt
Comments
Me too!
I could really do with some help on this as well (for slightly different reasons!).
Can anyone help?
thx
Sorted
To get the computed field to only generate first time around is a simple as wrapping this around your computed code
if ($node_field[0]['value'] == '' )
{ $node_field[0]['value'] = "hello" ; /* only work on insert and not on upates */ }
Thanks to jaxta who helped on this
Matt
www.crawlscore.com