function node_get_type_label
Same name in other branches
- 8.9.x core/modules/node/node.module \node_get_type_label()
- 10 core/modules/node/node.module \node_get_type_label()
- 11.x core/modules/node/node.module \node_get_type_label()
Returns the node type label for the passed node.
@todo Add this as generic helper method for config entities representing entity bundles.
Parameters
\Drupal\node\NodeInterface $node: A node entity to return the node type's label for.
Return value
string|false The node type label or FALSE if the node type is not found.
10 calls to node_get_type_label()
- hook_mail in core/
core.api.php - Prepares a message based on parameters.
- ModerationActionsTest::testNodeStatusActions in core/
modules/ content_moderation/ tests/ src/ Functional/ ModerationActionsTest.php - Tests the node status actions report moderation status to users correctly.
- NodeForm::form in core/
modules/ node/ src/ NodeForm.php - Gets the actual form array to be built.
- NodeForm::save in core/
modules/ node/ src/ NodeForm.php - Form submission handler for the 'save' action.
- NodeListBuilder::buildRow in core/
modules/ node/ src/ NodeListBuilder.php - Builds a row for an entity in the entity listing.
File
-
core/
modules/ node/ node.module, line 231
Code
function node_get_type_label(NodeInterface $node) {
$type = NodeType::load($node->bundle());
return $type ? $type->label() : FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.