To change Entities fields its better use `MODULE_ENTITY_presave()` function (more info in [docs][1]). In this case that you need change a node field use this function: function hook_node_presave(Drupal\Core\Entity\EntityInterface $entity) { } [1]: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21entity.api.php/function/hook_entity_presave/8.0.x