I have book pages (or actually cck pages added to a book outline) that have a node reference field. I would like to create a view that displays all of the nodes referenced within the book that is currently being viewed by a user. I can view the referenced nodes for the currently viewed book page, but I would like to also show the referenced nodes for the child pages of that book. Here is what I have tried so far, but I think I need to add some PHP magic to my book argument or my node reference argument in order to grab the other referenced nodes for the children of the parent book page:

$view = new view;
$view->name = 'field_location_reference_all';
$view->description = 'Nodereference view of all organizational locations for a book';
$view->tag = 'locations';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
  'nodereferer_referers' => array(
    'label' => 'Referencing Nodes',
    'required' => 1,
    'referrer_delta' => '-1',
    'referrer_field' => 'field_location_reference',
    'id' => 'nodereferer_referers',
    'table' => 'node',
    'field' => 'nodereferer_referers',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'nid' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'break_phrase' => 1,
    'not' => 0,
    'id' => 'nid',
    'table' => 'node',
    'field' => 'nid',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '4' => 0,
      '39' => 0,
      '10' => 0,
      '44' => 0,
      '14' => 0,
      '21' => 0,
      '9' => 0,
      '6' => 0,
      '30' => 0,
      '20' => 0,
      '15' => 0,
      '11' => 0,
      '16' => 0,
      '13' => 0,
      '26' => 0,
      '17' => 0,
      '45' => 0,
      '23' => 0,
      '7' => 0,
      '8' => 0,
      '31' => 0,
      '42' => 0,
      '41' => 0,
    ),
    'relationship' => 'nodereferer_referers',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'webform' => 0,
      'casetracker_basic_project' => 0,
      'casetracker_basic_case' => 0,
      'mass_contact' => 0,
      'sitenotes' => 0,
      'weblinks' => 0,
      'panel' => 0,
      'bio' => 0,
      'book' => 0,
      'contact_information' => 0,
      'content_community_center_reserva' => 0,
      'content_county_file_or_form_cck' => 0,
      'content_county_official' => 0,
      'content_file_index' => 0,
      'content_group_home_page' => 0,
      'content_minutes_or_agenda_cck' => 0,
      'content_road_report_cck' => 0,
      'county_facility_or_service' => 0,
      'custom_adm_script' => 0,
      'emerg_notice' => 0,
      'node_4web_edit' => 0,
      'page' => 0,
      'profile' => 0,
      'resuseable_location' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '30' => 0,
      '3' => 0,
      '18' => 0,
      '9' => 0,
      '21' => 0,
      '24' => 0,
      '25' => 0,
      '4' => 0,
      '27' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_php' => '',
  ),
  'depth' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'id' => 'depth',
    'table' => 'book_menu_links',
    'field' => 'depth',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '4' => 0,
      '39' => 0,
      '10' => 0,
      '44' => 0,
      '14' => 0,
      '21' => 0,
      '9' => 0,
      '6' => 0,
      '30' => 0,
      '20' => 0,
      '15' => 0,
      '11' => 0,
      '16' => 0,
      '13' => 0,
      '26' => 0,
      '17' => 0,
      '45' => 0,
      '23' => 0,
      '7' => 0,
      '8' => 0,
      '31' => 0,
      '42' => 0,
      '41' => 0,
    ),
    'relationship' => 'nodereferer_referers',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'webform' => 0,
      'casetracker_basic_project' => 0,
      'casetracker_basic_case' => 0,
      'mass_contact' => 0,
      'sitenotes' => 0,
      'weblinks' => 0,
      'panel' => 0,
      'bio' => 0,
      'book' => 0,
      'contact_information' => 0,
      'content_community_center_reserva' => 0,
      'content_county_file_or_form_cck' => 0,
      'content_county_official' => 0,
      'content_facility_sub_page' => 0,
      'content_file_index' => 0,
      'content_group_home_page' => 0,
      'content_minutes_or_agenda_cck' => 0,
      'content_road_report_cck' => 0,
      'county_facility_or_service' => 0,
      'custom_adm_script' => 0,
      'emerg_notice' => 0,
      'node_4web_edit' => 0,
      'page' => 0,
      'profile' => 0,
      'resuseable_location' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '30' => 0,
      '3' => 0,
      '18' => 0,
      '9' => 0,
      '21' => 0,
      '24' => 0,
      '25' => 0,
      '4' => 0,
      '27' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_php' => '',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('style_options', NULL);
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
  'relationship' => 'none',
  'build_mode' => 'full',
  'links' => 0,
  'comments' => 0,
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'view_loc');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);

Comments

bomarmonk’s picture

Any suggestions??

ak’s picture

Subscribing ...
I've got the same problem as described in your title.
If somebody could get this to work? http://drupal.org/node/614882#comment-2266600

dawehner’s picture

Does this doc helps you http://drupal.org/node/289738 ?

I think thats what you need

esmerel’s picture

Status: Active » Fixed

Solution suggested

Status: Fixed » Closed (fixed)

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