Drupal 8'de Node Silme Sırasında Ek İşlemler

Drupal 8'de bir node'u silerken farklı işlemler yapmak isterseniz hook_entity_delete hook'unu kullanabilirsiniz. Bu fonksiyon ile gelen entity parametresinden siline node içeriğine erişebilirsiniz.

function custom_entity_delete(Drupal\Core\Entity\EntityInterface $entity) {
   $entity_type = $entity->getEntityTypeId();

  if($entity_type == "node" && $entity->bundle() == "website") {

      drupal_set_message('Node siliniyor...');
      drupal_set_message("entity Id:".$entity->id());
      drupal_set_message("entity Type:".$entity->getEntityTypeId());
      drupal_set_message("entity bundle:".$entity->bundle());
      drupal_set_message("entity label:".$entity->label());

      $database = $entity->get('field_website_database')->getValue();
      drupal_set_message("database:".$database[0]['value']);
      
     // yapılacak diğer işlemler

  }

  }

Ofislerimiz

Drupart AR-GE

GOSB Teknopark Hi-Tech Bina 3.Kat B3 Gebze - KOCAELİ

+90 262 678 8872

[email protected]

Frankfurt

Media4People
Bleichstr. 26
64283 Darmstadt

+49 (0) 6151 – 492 70 23

[email protected]

Dublin

20 Harcourt Street
Dublin 2
D02 H364

+353871986950

[email protected]