-
Notifications
You must be signed in to change notification settings - Fork 0
/
faker.module
39 lines (34 loc) · 1.01 KB
/
faker.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* @file
* The Faker module file.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\faker\FakerHelper;
use Drupal\faker\Plugin\DevelGenerate\FakerContentDevelGenerate;
use Drupal\faker\Plugin\DevelGenerate\FakerUserDevelGenerate;
/**
* Implements hook_devel_generate_info_alter().
*
* Alter existing plugins from devel_generate.
*/
function faker_devel_generate_info_alter(array &$definitions) {
$definitions['content']['class'] = FakerContentDevelGenerate::class;
$definitions['user']['class'] = FakerUserDevelGenerate::class;
}
/**
* Implements hook_ENTITY_TYPE_presave().
*
* Target nodes that have been saved through devel_generate.
*/
function faker_node_presave(EntityInterface $node) {
FakerHelper::entityPreSave($node, FakerContentDevelGenerate::class);
}
/**
* Implements hook_ENTITY_TYPE_presave().
*
* Target user that have been saved through devel_generate.
*/
function faker_user_presave(EntityInterface $user) {
FakerHelper::entityPreSave($user, FakerUserDevelGenerate::class);
}