Using `hook_field_attach_presave` for replacing characters In Drupal 7, I used hook_field_attach_presave() to replace characters of a body field in the moment when the node is saved. Now i want to use the code for Drupal 8, but could not get it to work:

function my_module_field_attach_presave($entity_type, $entity){
  dpm($entity);
  $replacement_pattern = '/(?&lt;=\d\ )x(?= \d)/'; // replace a "x" surrounded by numbers with symbol "×"
  if(!empty($entity-&gt;body-&gt;value)){
    $entity-&gt;body-&gt;value = preg_replace($replacement_pattern, ' &amp;times; ', $entity-&gt;body-&gt;value);


}
The above code does not work, not even the dpm($entity) is printed. What is the problem here, is the hook not available in D8? I just found it here, not on official drupal sites. So if it does not exist, what's the alternative?

EDIT: Thanks to @Clive I got it working. Here's the code:

function my_module_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {
  $entity-&gt;setTitle('dd The new Title');
  $replacement_pattern = '/(?&lt;=\d\ )x(?= \d)/'; 
  if(!empty($entity-&gt;body-&gt;value)){
    $entity-&gt;body-&gt;value = preg_replace($replacement_pattern, ' &amp;times; ', $entity-&gt;body-&gt;value);
  }
}
hook_field_attach_presave() was removed some time ago, there's no such operation in Drupal 8. 

You can, however, use hook_entity_presave() or  hook_ENTITY_TYPE_presave() instead.