function EntityTestHooks::entityInsert

Implements hook_entity_insert().

File

core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php, line 267

Class

EntityTestHooks
Hook implementations for entity_test.

Namespace

Drupal\entity_test\Hook

Code

public function entityInsert(EntityInterface $entity) {
    if ($entity->getEntityTypeId() == 'entity_test_mulrev' && $entity->label() == 'EntityLoadedRevisionTest') {
        $entity->setNewRevision(FALSE);
        $entity->save();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.