I wrote a Drupal 7 module that creates its own node type. I added the number_integer field in node to act as a counter. How to set default counter field to zero when node is created?
Further, when processing node, I need to increase the counter value by one and save the new value. Can I do this by changing the $ node object and then calling node_save? Or is there a better way using the fields API or something like that?
I still would not dare to save node just like that. I will use anyway
$form_state = array('values' => array()); drupal_form_submit('story_node_form', $form_state, $node);
as in Drupal 6 (only with slightly different syntax).
Source: https://habr.com/ru/post/1789423/More articles:How do I unregister for KVO? - iphonePyQt4: stop window from focus - pythonFilling missing values on a table - javaLinq Query query caching - c #одновременно подключаться к нескольким базам данных в openBravo? - javaHow to easily convert a linq result to a collection of business objects - castingEclipse syntax coloring makes my code illegible - eclipseHow can I invert selected items in multiple lists using only one loop? - c #rubber band effect in android - with movement - androidUnable to scroll list in WP7 - c #All Articles