function node_import_types in Node import 5
Same name and namespace in other branches
- 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
1 call to node_import_types()
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;
}