node_get_types

modules/node/node.module, line 266

Versions
4.7
node_get_types()
5 – 6
node_get_types($op = 'types', $node = NULL, $reset = FALSE)

Builds a list of available node types, and returns all of part of this list in the specified format.

Parameters

$op The format in which to return the list. When this is set to 'type', 'module', or 'name', only the specified node type is returned. When set to 'types' or 'names', all node types are returned.

$node A node object, array, or string that indicates the node type to return. Leave at default value (NULL) to return a list of all node types.

$reset Whether or not to reset this function's internal cache (defaults to FALSE).

Return value

Either an array of all available node types, or a single node type, in a variable format.

▾ 37 functions call node_get_types()

blogapi_admin_settings in modules/blogapi/blogapi.module
blog_form in modules/blog/blog.module
Implementation of hook_form().
book_form in modules/book/book.module
Implementation of hook_form().
book_help in modules/book/book.module
Implementation of hook_help().
forum_form in modules/forum/forum.module
Implementation of hook_form().
hook_form in developer/hooks/node.php
Display a node editing form.
hook_search in developer/hooks/core.php
Define a custom search routine.
node_access in modules/node/node.module
Determine whether the current user may perform the given operation on the specified node.
node_add in modules/node/node.module
Present a node submission form or a set of links to such forms.
node_admin_nodes in modules/node/node.module
node_content_form in modules/node/node.module
Implementation of hook_form().
node_example_form in developer/examples/node_example.module
Implementation of hook_form().
node_filters in modules/node/node.module
List node administration filters that can be applied.
node_forms in modules/node/node.module
Implementation of hook_forms(). All node forms share the same form handler
node_form_alter in modules/node/node.module
Implementation of hook_form_alter().
node_form_submit in modules/node/node.module
node_help in modules/node/node.module
Implementation of hook_help().
node_hook in modules/node/node.module
Determine whether a node hook exists.
node_invoke in modules/node/node.module
Invoke a node hook.
node_menu in modules/node/node.module
Implementation of hook_menu().
node_overview_types in modules/node/content_types.inc
Displays the content type admin overview page.
node_perm in modules/node/node.module
Implementation of hook_perm().
node_preview in modules/node/node.module
Generate a node preview.
node_search in modules/node/node.module
Implementation of hook_search().
node_types_rebuild in modules/node/node.module
Resets the database cache of node types, and saves all new or non-modified module-defined node types to the database.
node_type_delete in modules/node/node.module
Deletes a node type from the database.
node_type_form_validate in modules/node/content_types.inc
Implementation of hook_form_validate().
node_validate in modules/node/node.module
Perform validation checks on the given node.
poll_form in modules/poll/poll.module
Implementation of hook_form().
system_theme_settings in modules/system/system.module
Menu callback; display theme configuration for entire site and individual themes.
system_update_119 in modules/system/system.install
system_update_179 in modules/system/system.install
Update base paths for relative URLs in custom blocks, profiles and various variables.
taxonomy_form_vocabulary in modules/taxonomy/taxonomy.module
Display form for adding and editing vocabularies.
taxonomy_overview_vocabularies in modules/taxonomy/taxonomy.module
List and manage vocabularies.
theme_get_settings in includes/theme.inc
Retrieve an associative array containing the settings for a theme.
tracker_page in modules/tracker/tracker.module
Menu callback. Prints a listing of active nodes on the site.
_blogapi_get_node_types in modules/blogapi/blogapi.module

Code

<?php
function node_get_types($op = 'types', $node = NULL, $reset = FALSE) {
  static $_node_types, $_node_names;

  if ($reset || !isset($_node_types)) {
    list($_node_types, $_node_names) = _node_types_build();
  }

  if ($node) {
    if (is_array($node)) {
      $type = $node['type'];
    }
    elseif (is_object($node)) {
      $type = $node->type;
    }
    elseif (is_string($node)) {
      $type = $node;
    }
    if (!isset($_node_types[$type])) {
      return FALSE;
    }
  }
  switch ($op) {
    case 'types':
      return $_node_types;
    case 'type':
      return $_node_types[$type];
    case 'module':
      return $_node_types[$type]->module;
    case 'names':
      return $_node_names;
    case 'name':
      return $_node_names[$type];
  }
}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.