Skip to main content
1 of 2
Vagner
  • 2.5k
  • 15
  • 20

To change Entities fields its better use MODULE_ENTITY_presave() function (more info in docs).

In this case that you need change a node field use this function:

function hook_node_presave(Drupal\Core\Entity\EntityInterface $entity) {

}
Vagner
  • 2.5k
  • 15
  • 20