node_type_update_nodes

node_type_update_nodes($old_id, $new_id)

Updates all nodes of one type to be of another type.

Parameters

string $old_id: The current node type of the nodes.

string $new_id: The new node type of the nodes.

Return value

The number of nodes whose node type field was modified.

File

core/modules/node/node.module, line 395
The core module that allows content to be submitted to the site.

Code

function node_type_update_nodes($old_id, $new_id) {
  return \Drupal::entityManager()->getStorage('node')->updateType($old_id, $new_id);
}
doc_Drupal
2016-10-29 09:32:00
Comments
Leave a Comment

Please login to continue.