function views_node_access_check_node_type in Views node access 7
Same name and namespace in other branches
- 6 views_node_access.module \views_node_access_check_node_type()
Node type access function for views hook menu.
4 string references to 'views_node_access_check_node_type'
- views_node_access_plugin_access_node_type::get_access_callback in ./
views_node_access_plugin_access_node_type.inc - Determine the access callback and arguments.
- views_node_access_plugin_access_node_type_current_user::get_access_callback in ./
views_node_access_plugin_access_node_type_current_user.inc - Determine the access callback and arguments.
- views_node_access_plugin_access_node_type_perm::get_access_callback in ./
views_node_access_plugin_access_node_type_perm.inc - Determine the access callback and arguments.
- views_node_access_plugin_access_node_type_role::get_access_callback in ./
views_node_access_plugin_access_node_type_role.inc - Determine the access callback and arguments.
File
- ./
views_node_access.module, line 20 - Views node access - hook implementations and access function for views hook_menu.
Code
function views_node_access_check_node_type($types = array(), array $pre_callback = array()) {
$access = TRUE;
if (!empty($pre_callback)) {
$function_name = array_shift($pre_callback);
if (function_exists($function_name)) {
$access = call_user_func_array($function_name, $pre_callback);
}
}
if (!$access) {
return $access;
}
if (arg(0) != 'node' || !is_numeric(arg(1))) {
return FALSE;
}
$node = node_load(arg(1));
if (in_array($node->type, $types)) {
return TRUE;
}
return FALSE;
}