Create a node programatically in Drupal 8

Опубликовано: 01 Октябрь 2024
на канале: Drupal Up - Drupal 8 Video Tutorials
6,138
84

We will see how we may create a node in Drupal 8 with a bit of code.

If you liked this video, please also have a look at my new course about Drupal 8 module development here (with 50% discount):
https://goo.gl/LPyeDw

The nodes in Drupal are the most popular bits of content. This means it is quite often required to use code to create or edit them. In this video, we are going to learn how to create new ones.

We are going to be actively using the Drupal\node\Entity\Node class and with its help, we are going to be creating new nodes with different field values.

We would also use the devel and kint modules to study the structure of the nodes in order to be able to create exactly the node instances we need.

More videos and stuff you may find on https://drupal-up.com

To support us please, don't forget to share, subscribe, like and comment on the video!