Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

The API function node_type_get_name() was changed to node_type_get_label() to get the human-readable name of the content type.

Drupal 7

$title = t('Add new @node_type', array('@node_type' => node_type_get_name($type)));

Drupal 8

$title = t('Add new @node_type', array('@node_type' => node_type_get_label($type)));

Function _node_extract_type() removed in favour of node_type_get_base(), whose parameter was changed to accept a content type name not a full node object.

Drupal 7

$base = node_type_get_base($node);
return module_hook($base, $hook);

Drupal 8

$base = node_type_get_base($type);
return module_hook($base, $hook) ? $base . '_' . $hook : FALSE;

Added new API function node_get_type_label() to return a content type name of the node.

Drupal 7

$type_name = node_type_get_name($node);
 drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $node->title)), PASS_THROUGH);

Drupal 8

drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => node_get_type_label($node), '@title' => $node->label())), PASS_THROUGH);
Impacts: 
Module developers
Themers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done

Comments

headstartcms’s picture

Need to solve the bugs . .. Tks!

Notice: Undefined property: stdClass::$type in _node_extract_type() (line 371
Notice: Undefined property: stdClass::$nid in node_build_content() (line 1366 of /modules/node/node.module).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7633 of /sites/includes/common.inc).

LINE 1366
field_attach_prepare_view('node', array($node->nid => $node), $view_mode, $langcode);

ADDED return is_object($node) ? $node->type : $node;

entity_prepare_view('node', array($node->nid => $node), $langcode);

Node.module

return is_object($node) ? $node->type : $node;

webdrips’s picture

node_type_get_label() and node_type_get_name() with node_get_type_label() have been replaced by node_get_type_label(); see https://www.drupal.org/node/2422643

Looking to Migrate to Drupal 9/10? Have a look at our Drupal 9 demo site and request access.