function node_type_get_names in Drupal 10
Same name and namespace in other branches
- 8 core/modules/node/node.module \node_type_get_names()
- 7 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.
3 calls to node_type_get_names()
- BookSettingsForm::buildForm in core/
modules/ book/ src/ Form/ BookSettingsForm.php - Form constructor.
- NodeSearch::searchFormAlter in core/
modules/ node/ src/ Plugin/ Search/ NodeSearch.php - 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 213 - 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'));
}