Hello,
nice module, suits my clients' needs almost perfectly. Only thing that we're missing is views support! Restricted content is still showing in views. I noticed there's something being done with the body field in views? Why's this?

Comments

afox’s picture

Assigned: Unassigned » afox
Status: Active » Needs work

I started to work on this by myself. So far, I have all the pieces, but for some reason it doesn't work. If someone more experienced with views could lend a hand. So far I have (along with hook_views_api() in restrict_content.module):
restrict_content.views.inc

function restrict_content_views_data() {
 
  $data = array();

$data['node_restrictions']['table']['group'] = t('Node restrictions');

    $data['node_restrictions']['rid'] = array(
      'title' => t('Restrict by role'),
      'help' => t('Filter by roles to which content is restricted to.'),
	    'filter' => array(
  	    'handler' => 'restrict_content_views_handler_filter_byrole',
    	),
    );
 
  return $data;
}
/**
 * Implementation of hook_views_handlers().
 */
function restrict_content_views_handlers() {
  return array(
    'info' => array(
      'path' => drupal_get_path('module', 'restrict_content') .'/includes',
    ),
    'handlers' => array(
     'restrict_content_views_handler_filter_byrole' => array(
        'parent' => 'views_handler_filter_in_operator',
      ),

    ),
  );
}

restrict_content_views_handler_filter_byrole.inc

class restrict_content_views_handler_filter_byrole extends views_handler_filter_in_operator {
  function get_value_options() {
    if (!isset($this->value_options)) {
      $this->value_title = t('Role');
      $this->value_options = restrict_content_roles();
    }
  }
}

Nothing is displayed in the views filters which is confusing. Shouldn't there be at least something if hook_views_data() is correct? I checked and compared mine with other modules and it should be ok. Clear all caches, including views cache while trying.

bobooon’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)

Project has been discontinued in favor of https://www.drupal.org/project/content_access.