Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In comment #3 of #1748302: Lets generate kick-ass demo content!!!, in use hook_node_presave() and I use $node's ->devel_generate to determine if a node is dummy content. If it is I can make generated content more realistic.
The $user object does not have a ->devel_generate property, it would be nice to have this so we could intercept generated users in hook_user_presave(). This could be interesting for example if we have first and last name fields. By defaut devel_generate puts long strings in there. It would be more realistic to trim these to a 10-15 characters.
Comment | File | Size | Author |
---|---|---|---|
#8 | 2252965-8-make-hooks-aware-of-generated-terms.patch | 691 bytes | GaëlG |
#2 | 2252965-2-devel-user-devel-generate-property.patch | 633 bytes | alberto56 |
#1 | 2252965-1-devel-user-devel-generate-property.patch | 662 bytes | alberto56 |
Comments
Comment #1
alberto56 CreditAttribution: alberto56 commentedHere's a patch I use for this.
Comment #2
alberto56 CreditAttribution: alberto56 commentedWithout the
dpm()
in the code, it's better.Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedLooks reasonable. Do we need this in D8 as well?
Comment #4
alberto56 CreditAttribution: alberto56 commentedActually I just noticed that D8 has this for users, in line 117 of devel_generate/lib/Drupal/devel_generate/Plugin/DevelGenerate/UserDevelGenerate.php
For nodes it's there as well, as it is in D7. In D8 it's on line 383 of devel_generate/lib/Drupal/devel_generate/Plugin/DevelGenerate/ContentDevelGenerate.php
Comment #5
alberto56 CreditAttribution: alberto56 commentedOne possible issue is that the devel_generate property is boolean for users and an array for nodes, in D8, and same for D7 with this patch.
Comment #6
alberto56 CreditAttribution: alberto56 commentedRelated: #2257271: Provide a flag to let third party modules know that content is dummy content
Comment #7
willzyx CreditAttribution: willzyx commentedClosing for lack of activity. Feel free to reopen if the issue still exists
Comment #8
GaëlGActually, D8 handles users but not terms. Here's a simple patch.
Comment #9
GaëlGComment #10
amarphule CreditAttribution: amarphule at DevsAdda for DevsAdda commented#8 applied clean and works for me on drupal-8.6.15.
Comment #11
GaëlGComment #12
moshe weitzman CreditAttribution: moshe weitzman commented