/**
* Implementation of hook_node_import_types().
*/
function path_redirect_node_import_types() {
return array(
'path_redirect' => array(
'title' => t('Path redirect'),
'can_create' => user_access('administer redirects'), <-- Why can't we do this?
'create' => ...
)
);
}
It didn't make sense why I can't just use a boolean value for can_create in hook_node_import_types(), like hook_menu(), especially if it's a simple user_access check. Patch attached for this feature.
| Comment | File | Size | Author |
|---|---|---|---|
| 0-node-import-can-create-boolean-D6.patch | 1022 bytes | dave reid |
Comments
Comment #1
Robrecht Jacques commentedYes that makes sense and patch looks fine.
Comment #2
Robrecht Jacques commentedCommitted to CVS. Will be included in -rc5. Thanks!
Implemented it in user_node_import_types(), node_node_import_types() and taxonomy_node_import_types().
Comment #3
dave reidI would probably also suggest one small quick change just in-case the can create function returns a non-boolean value that is equal, but not identical to TRUE.
Instead of:
+ if ($typeinfo['can_create'] === TRUE || (function_exists($function = $typeinfo['can_create']) && $function($type) === TRUE)) {Use:
+ if ($typeinfo['can_create'] === TRUE || (function_exists($function = $typeinfo['can_create']) && $function($type) == TRUE)) {Comment #4
Robrecht Jacques commentedCommitted. Thanks.