Same name and namespace in other branches
- 7.x modules/node/node.module \node_type_get_names()
- 8.9.x core/modules/node/node.module \node_type_get_names()
- 9 core/modules/node/node.module \node_type_get_names()
Returns a list of available node type names.
This list can include types that are queued for addition or deletion.
Return value
string[] An array of node type labels, keyed by the node type name.
1 call to node_type_get_names()
- NodeTypeTest::testNodeTypeGetFunctions in core/
modules/ node/ tests/ src/ Functional/ NodeTypeTest.php - Ensures that node type functions (node_type_get_*) work correctly.
File
- core/
modules/ node/ node.module, line 225 - The core module that allows content to be submitted to the site.
Code
function node_type_get_names() {
return array_map(function ($bundle_info) {
return $bundle_info['label'];
}, \Drupal::service('entity_type.bundle.info')
->getBundleInfo('node'));
}