Skip to main content
removed the second question, asked when an answer was given (Questions are not for a _back and forth_ iteration between the OP and the users who answer.)
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

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?

We have a headless Drupal 8 content repository which we access via the rest 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 box on the "edit node" page.

How might I set Drupal to create revisions automatically? Thanks!

Clarification: all nodes are created programmatically via the rest 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?

We have a headless Drupal 8 content repository which we access via the REST 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" checkbox on the node edit form.

How might I set Drupal to create revisions automatically?

All nodes are created programmatically via the REST API.

added 508 characters in body
Source Link
Tony Stecca
  • 381
  • 1
  • 3
  • 14

We have a headless Drupal 8 content repository which we access via the rest 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 box on the "edit node" page.

How might I set Drupal to create revisions automatically? Thanks!

ClarificationClarification: all nodes are created programmatically via the rest 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?

We have a headless Drupal 8 content repository which we access via the rest 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 box on the "edit node" page.

How might I set Drupal to create revisions automatically? Thanks!

Clarification: all nodes are created programmatically via the rest API.

We have a headless Drupal 8 content repository which we access via the rest 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 box on the "edit node" page.

How might I set Drupal to create revisions automatically? Thanks!

Clarification: all nodes are created programmatically via the rest 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?

We have a headless Drupal 8 content repository which we access via the rest 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 box on the "edit node" page.

How might I set Drupal to create revisions automatically? Thanks!

Clarification: all nodes are created programmatically via the rest API.

We have a headless Drupal 8 content repository which we access via the rest 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 box on the "edit node" page.

How might I set Drupal to create revisions automatically? Thanks!

We have a headless Drupal 8 content repository which we access via the rest 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 box on the "edit node" page.

How might I set Drupal to create revisions automatically? Thanks!

Clarification: all nodes are created programmatically via the rest API.

edited title
Link
mpdonadio
  • 38.1k
  • 8
  • 89
  • 142
Loading
removed "Drupal" from the title
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Loading
Source Link
Tony Stecca
  • 381
  • 1
  • 3
  • 14
Loading