function node_get_type_label

Returns the node type label for the passed node.

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.

Deprecated

in drupal:11.3.0 and is removed from drupal:13.0.0. Use $node->getBundleEntity()->label() instead.

See also

https://www.drupal.org/node/3533301

File

core/modules/node/node.module, line 115

Code

function node_get_type_label(NodeInterface $node) {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:13.0.0. Use $node->getBundleEntity()->label(). See https://www.drupal.org/node/3533301', E_USER_DEPRECATED);
  $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.