Создать ноду программно друпал 7 пример
Primary tabs
есть такой пример =
<?php
/**
* Basic Node Creation Example for Drupal 7
*
* This example:
* - Assumes a standard Drupal 7 installation
* - Does not verify that the field values are correct
*/
$body_text = 'This is the body text I want entered with the node.';
$node = new stdClass();
$node->type = 'article';
node_object_prepare($node);
$node->title = 'Node Created Programmatically on ' . date('c');
$node->language = LANGUAGE_NONE;
$node->body[$node->language][0]['value'] = $body_text;
$node->body[$node->language][0]['summary'] = text_summary($body_text);
$node->body[$node->language][0]['format'] = 'filtered_html';
$path = 'content/programmatically_created_node_' . date('YmdHis');
$node->path = array('alias' => $path);
node_save($node);
?>
отсюда =http://webcache.googleusercontent.com/search?q=cache:BJEiCa2XqUsJ:www.group42.ca/creating_and_updating_nodes_programmatically_in_drupal_7+http://www.group42.ca+creating_and_upda&cd=1&hl=ru&ct=clnk&gl=ru
- drupalDrum's blog
- Log in to post comments
- 7393 reads
Comments
drupalDrum
Sat, 06/09/2012 - 10:13
Permalink
здесь пишут, что нода неявно
здесь пишут, что нода неявно передаётся по ссылке, а потому после вызова функции - в случае успешного её завершения можно получить nid - айдишник.