function node_type_update_nodes in Drupal 8
Same name and namespace in other branches
- 5 modules/node/node.module \node_type_update_nodes()
- 6 modules/node/node.module \node_type_update_nodes()
- 7 modules/node/node.module \node_type_update_nodes()
- 9 core/modules/node/node.module \node_type_update_nodes()
- 10 core/modules/node/node.module \node_type_update_nodes()
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.
1 call to node_type_update_nodes()
- NodeType::postSave in core/
modules/ node/ src/ Entity/ NodeType.php - Acts on a saved entity before the insert or update hook is invoked.
File
- core/
modules/ node/ node.module, line 434 - The core module that allows content to be submitted to the site.
Code
function node_type_update_nodes($old_id, $new_id) {
return \Drupal::entityTypeManager()
->getStorage('node')
->updateType($old_id, $new_id);
}