Como criar programaticamente nós com campos de data e imagem?
Eu sei que posso fazer isso no Drupal 7 com o seguinte código.
global $user;
$node = new stdClass();
$node->title = "YOUR TITLE";
$node->type = "YOUR_NODE_TYPE";
node_object_prepare($node); // Sets some defaults. Invokes hook_prepare() and hook_node_prepare().
$node->language = LANGUAGE_NONE; // Or e.g. 'en' if locale is enabled
$node->uid = $user->uid;
$node->status = 1; //(1 or 0): published or not
$node->promote = 0; //(1 or 0): promoted to front page
//image field
$existing_filepath = "/home/nzcodarnoc/sites/default/files/imported/picture.jpg"
$new_filepath = "public://picture.jpg"
// Create the file object
$drupal_file = file_save_data(file_get_contents($existing_filepath), $new_filepath);
$drupal_file->alt = $node->title;
$drupal_file->title = $node->title;
// Assign the file object to the node, as an array
$node->field_my_file[$node->language][0] = get_object_vars($drupal_file);
//date field
$node->birth_date[LANGUAGE_NONE][0]['value'] = time();
$node = node_submit($node); // Prepare node for saving
node_save($node);
Qual é o código equivalente para o Drupal 8?