showing results for - "drupal 8 programmatically saving node doesn 27t save custom field values"
Elisa
20 Jun 2019
1use Drupal\node\Entity\Node;
2
3$my_article = Node::create(['type' => 'article']);
4$my_article->set('title', 'My article');
5$my_article->set('field_text', 'My text');
6$my_article->set('field_image', FID);
7$my_article->set('field_user', UID);
8$my_article->enforceIsNew();
9$my_article->save();