function views_access_callback_access_callback in Views Access Callback 7
Same name and namespace in other branches
- 8 views_access_callback.module \views_access_callback_access_callback()
- 6 views_access_callback.module \views_access_callback_access_callback()
Intermediary access callback function getting view arguments and calling real function specified in view definition.
1 call to views_access_callback_access_callback()
- views_access_callback_plugin_access_callback::access in ./
views_access_callback_plugin_access_callback.inc - Determine if the current user has access or not.
1 string reference to 'views_access_callback_access_callback'
- views_access_callback_plugin_access_callback::get_access_callback in ./
views_access_callback_plugin_access_callback.inc - Determine the access callback and arguments.
File
- ./
views_access_callback.module, line 19
Code
function views_access_callback_access_callback($view_name, $display_id, $access_callback) {
// Init view.
$view = views_get_view($view_name);
$view
->set_display($display_id);
$view
->init_handlers();
// Find the values for any arguments embedded in the path via '%'.
$i = 0;
foreach (explode('/', $view->display_handler
->get_option('path')) as $element) {
if ($element == '%') {
$view->args[] = arg($i);
}
$i++;
}
// Now handle any implicit arguments from the end of the path.
$num_arguments = count($view->argument);
while (count($view->args) < $num_arguments) {
$view->args[] = arg($i);
$i++;
}
$result = FALSE;
if (function_exists($access_callback)) {
$result = call_user_func_array($access_callback, $view->args);
}
return $result;
}