views_published_or_roles.module in Views Published or Roles 7
File
views_published_or_roles.module
View source
<?php
function views_published_or_roles_api() {
return array(
'api' => 3,
);
}
function views_published_or_roles_views_data_alter(&$data) {
$handler_path = drupal_get_path('module', 'views_published_or_roles') . '/handler';
$data['node']['status_has_role'] = array(
'title' => t('Published or has role'),
'help' => t('Filters out unpublished nodes if the current user cannot view them.'),
'filter' => array(
'field' => 'status',
'handler' => 'views_handler_filter_views_published_or_roles_has_roles',
'label' => t('Published or has role'),
'path' => $handler_path,
'no group by' => TRUE,
),
);
$data['node']['current_user_has_roles'] = array(
'title' => t('Current user has roles'),
'help' => t('Filters by current user\'s roles'),
'filter' => array(
'handler' => 'views_handler_filter_views_published_or_roles_current_user_has_roles',
'label' => t('Current user has roles'),
'path' => $handler_path,
'no group by' => TRUE,
),
);
}