You are here

function node_import_types in Node import 5

Same name and namespace in other branches
  1. 6 node_import.inc \node_import_types()

Get a list of supported nodes types.

Parameters

$check_permission: Boolean. If TRUE, only returns the types for which the user has 'create' permissions. If FALSE, then all types which node_import supports are returned (even if the user is not allowed to create the nodes).

Return value

Array ($type => $name) with all supported types.

See also

hook_node_import_types()

1 call to node_import_types()
_node_import_start in ./node_import.module

File

./node_import.api.inc, line 41

Code

function node_import_types($check_permission = TRUE) {
  static $types = NULL;
  static $permitted_types = NULL;
  if (!isset($types)) {
    $types = array();
    foreach (module_invoke_all('node_import_types') as $type => $name) {
      $types[$type] = $name;
    }
    asort($types);
  }
  if (!isset($permitted_types)) {
    $permitted_types = array();
    foreach ($types as $type => $name) {
      if (node_access('create', $type)) {
        $permitted_types[$type] = $name;
      }
    }
  }
  return $check_permission ? $permitted_types : $types;
}