Skip to content

Auto create entity with values from another one and the current user

Version

You can apply this model as a recipe (Drupal 10.3 or later) to your own Drupal site:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Import recipe
composer require drupal-eca-recipe/eca_lib_0020

# Apply recipe with Drush (requires version 13 or later):
drush recipe ../recipes/eca_lib_0020

# Apply recipe without Drush:
cd web && php core/scripts/drupal recipe ../recipes/eca_lib_0020

# Rebuilding caches is optional, sometimes required:
drush cr

Purpose

This model reacts upon creating a new page node. It then creates a new article node, its title is populated with the page auther's name, some static text and the title of the created page.

The recorded video provides more explanation as we go on.

Dependencies

  • config
    • node.type.article
    • node.type.page
  • module
    • eca_content

Used plugins

Events

Actions