function node_type_get_type

7.x node.module node_type_get_type($node)

Returns the node type of the passed node or node type string.


$node: A node object or string that indicates the node type to return.

Return value

A single node type, as an object, or FALSE if the node type is not found. The node type is an object containing fields from hook_node_info() return values, as well as the field 'type' (the machine-readable type) and other fields used internally and defined in _node_types_build(), hook_node_info(), and node_type_set_defaults().

11 calls to node_type_get_type()
comment_node_type_load in drupal/modules/comment/comment.module
Menu loader callback for Field UI paths.
DrupalWebTestCase::drupalCreateContentType in drupal/modules/simpletest/drupal_web_test_case.php
Creates a custom content type based on default settings.
forum_form in drupal/modules/forum/forum.module
Implements hook_form().
hook_form in drupal/modules/node/node.api.php
Display a node editing form.
NodeTypeTestCase::testNodeTypeGetFunctions in drupal/modules/node/node.test
Ensures that node type functions (node_type_get_*) work correctly.

... See full list


drupal/modules/node/node.module, line 410
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.


function node_type_get_type($node) {
  $type = _node_extract_type($node);
  $types = _node_types_build()->types;
  return isset($types[$type]) ? $types[$type] : FALSE;