Hi, could you please examine the following issue tracked at Views:

#755956: Is it possible to control display of specific fields by permissions or role within a view result ?

Node Relationships (with its backrefs feature) is only one module one could combined with the "trick" described there, so it is reported at Views.

I need to be able to have 2 Page displays within my (cloned and adapted) noderelationships_backref view to exploit the nice Views trick, however the path of each Page display seems to be readonly (and greyed out in the Views UI).

Grateful for tips.

Comments

webel’s picture

I've found where Node Relationships is overriding the view Page display paths.
From noderelationships.inc:


/**
 * Apply custom configuration to the given back reference view.
 */
function noderelationships_customize_backref_view(&$view, $display_id, &$view_args, $reset_current_display = TRUE) {

// ...

  // Customization related to the page display.
  if ($view->display_handler->display->display_plugin == 'page') {

// ...

  // Reset the current page display so that the changes take effect.
  // This is necessary for AJAX requests and page displays managed by
  // the views menu callback.
  if ($reset_current_display && isset($view->current_display)) {
    unset($view->current_display);
  }

  // Activate the specified display.
  $view->set_display($display_id);

  // Allow external modules alter the view.
  drupal_alter('noderelationships_view', $view_overrides, $view, $display_id, $view_args);

  // Apply dynamic customization to the view display.
  foreach ($view_overrides as $option => $definition) {
    $view->display_handler->override_option($option, $definition);
  }

// ...
}

webel’s picture

As far as I can tell, Node Relationships backref facility is always going to call the default view display anyway, not an access-specific Page (no matter what path).
From noderelationships.pages.inc:


function noderelationships_backref_render_view($back_reference_view, $context, $render_view_title = TRUE) {
  static $pager_element = 0;

  $referred_node = &$context['referred_node'];
  $referred_type = &$context['referred_type'];
  $referrer_type = &$context['referrer_type'];
  $field_name = $context['field_name'];

// ...

  // Prepare the name of the view and display.
  if (empty($back_reference_view)) {
    $view_name = NODERELATIONSHIPS_BACKREF_VIEW_NAME;
    $display_id = 'default';
  }
  else {
    list($view_name, $display_id) = explode(':', $back_reference_view);
  }

// ...

webel’s picture

I would like to be able to force the node relationships backref views to call on a specific Page display path (which is shared by multiple Page displays with different access level, and showing different fields per role).

[Note that this is not even the same as selecting a specific a Page display option, Views will switch between Page displays according to access role, for a given shared path, not by display id, as described by merlinofchaos: http://drupal.org/node/755956#comment-2791922 ]

markus_petrux’s picture

Status: Active » Fixed

I think you need to override the dynamic customizations made by Node Relationships module to the view. You can do it using a noderelationships hook. See this: #589136: How to customize noderelationships views in real-time, when these views are executed

webel’s picture

@markus_petrux Thanks for tip, will try out and report back result here.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.