function node_import_types in Node import 6
Same name and namespace in other branches
- 5 node_import.api.inc \node_import_types()
Returns a list of available content types.
Parameters
$check_access: Boolean. If TRUE, only the types the user can create are returned. If FALSE, all types are returned.
$reset: Boolean. If TRUE, the internal cache is rebuilt.
Return value
Array of types. See hook_node_import_types().
Related topics
7 calls to node_import_types()
- node_import_add_form in ./
node_import.admin.inc - Creates a new import task by letting the user fill in a wizard.
- node_import_add_form_validate_next in ./
node_import.admin.inc - node_import_create in ./
node_import.inc - Create a new object of specified $type.
- node_import_create_taxonomy in supported/
taxonomy.inc - Create a new vocabulary or term by submitting the corresponding form.
- node_import_task_details in ./
node_import.admin.inc
File
- ./
node_import.inc, line 118 - Public API of the Node import module.
Code
function node_import_types($check_access = TRUE, $reset = FALSE) {
static $types;
static $allowed_types;
if (!isset($types) || $reset) {
$defaults = array(
'title' => '',
'can_create' => FALSE,
'create' => '',
);
$utypes = (array) module_invoke_all('node_import_types');
foreach ($utypes as $type => $typeinfo) {
$utypes[$type] = array_merge($defaults, $typeinfo);
}
drupal_alter('node_import_types', $utypes);
$types = array_map('strip_tags', node_import_extract_property($utypes, 'title'));
asort($types);
foreach ($types as $type => $title) {
$types[$type] = $utypes[$type];
}
$allowed_types = array();
foreach ($types as $type => $typeinfo) {
if ($typeinfo['can_create'] === TRUE || function_exists($function = $typeinfo['can_create']) && $function($type) == TRUE) {
$allowed_types[$type] = $typeinfo;
}
}
}
return $check_access ? $allowed_types : $types;
}