We have a headless Drupal 8 content repository which we access via the restREST API. I'd like Drupal to track revisions automatically for all nodes, as soon as they are created. I'm only aware of the "create new revision" check boxcheckbox on the "edit node" pagenode edit form.
How might I set Drupal to create revisions automatically? Thanks!
Clarification: all All nodes are created programmatically via the restREST API.
Update: Hi. I've tried using hook_entity_presave and setNewRevion but I haven't had any luck. I've tried variations on the following code. Note that I'm running it in generic Hello World module I have hanging around and that's why the function is called hello_world_entity_presave.
function hello_world_entity_presave(Drupal\Core\Entity\EntityInterface $entity) { setNewRevision(TRUE); }
Is the syntax correct for the hook and is it sufficient to call setNewRevision(TRUE) as it is?