Same name and namespace in other branches
  1. 8.9.x core/modules/node/node.module \node_get_type_label()
  2. 9 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.

9 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.

... See full list

File

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

Code

function node_get_type_label(NodeInterface $node) {
  $type = NodeType::load($node
    ->bundle());
  return $type ? $type
    ->label() : FALSE;
}