node_get_type_label

node_get_type_label(NodeInterface $node)

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.

File

core/modules/node/node.module, line 277
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;
}
doc_Drupal
2016-10-29 09:31:54
Comments
Leave a Comment

Please login to continue.