lightning_test.module in Lightning Core 8
Same filename and directory in other branches
Contains internal functionality for use during functional testing.
File
modules/lightning_test/lightning_test.moduleView source
<?php
/**
* @file
* Contains internal functionality for use during functional testing.
*/
use Drupal\Core\Entity\EntityInterface;
/**
* Implements hook_entity_insert().
*/
function lightning_test_entity_insert(EntityInterface $entity) {
$state = \Drupal::state();
$entity_type = $entity
->getEntityTypeId();
if ($entity_type == 'media') {
$delete = $state
->get('_delete', []);
$delete[$entity_type][] = $entity
->id();
$state
->set('_delete', $delete);
}
elseif ($entity_type == 'field_config') {
$delete = $state
->get('_fields', []);
array_push($delete, $entity
->id());
$state
->set('_fields', $delete);
}
$state
->resetCache();
}
Functions
Name | Description |
---|---|
lightning_test_entity_insert | Implements hook_entity_insert(). |