1 node.views.inc | node_views_analyze($view) |
Implements hook_views_analyze().
File
- core/
modules/ node/ views/ node.views.inc, line 783 - Provide views data and handlers for node.module.
Code
function node_views_analyze($view) {
$ret = array();
// Check for something other than the default display:
if ($view->base_table == 'node') {
foreach ($view->display as $id => $display) {
if (empty($display->handler)) {
continue;
}
if (!$display->handler->is_defaulted('access') || !$display->handler->is_defaulted('filters')) {
// check for no access control
$access = $display->handler->get_option('access');
if (empty($access['type']) || $access['type'] == 'none') {
$roles = user_roles(FALSE, NULL, TRUE);
if (!in_array('access content', $roles[BACKDROP_ANONYMOUS_ROLE]->permissions) || !in_array('access content', $roles[BACKDROP_AUTHENTICATED_ROLE]->permissions)) {
$ret[] = views_ui_analysis(t('Some roles lack permission to access content, but display %display has no access control.', array('%display' => $display->display_title)), 'warning');
}
$filters = $display->handler->get_option('filters');
foreach ($filters as $filter) {
if ($filter['table'] == 'node' && ($filter['field'] == 'status' || $filter['field'] == 'status_extra')) {
continue 2;
}
}
$ret[] = views_ui_analysis(t('Display %display has no access control but does not contain a filter for published nodes.', array('%display' => $display->display_title)), 'warning');
}
}
}
}
foreach ($view->display as $id => $display) {
if ($display->display_plugin == 'page') {
if ($display->handler->get_option('path') == 'node/%') {
$ret[] = views_ui_analysis(t('Display %display has set node/% as path. This will not produce what you want. If you want to have multiple versions of the node view, use panels.', array('%display' => $display->display_title)), 'warning');
}
}
}
return $ret;
}