I don't know if this is possible, but I want to create a block view out of Nodes which have a view reference.
They should be visible in the sidebar, if the referenced view (page) is visible.
For Node Reference it's easy:
- argument: node reference
- Provide default argument
- Node ID from URL
I want to build something similar for view reference.
I tried different approaches, including php validation. But even when passing the argument (view name or view id) in the preview, the result is empty.
Query:
SELECT node.nid AS nid,
node_data_field_view_reference.field_image_fid AS node_data_field_view_reference_field_image_fid,
node_data_field_view_reference.field_image_list AS node_data_field_view_reference_field_image_list,
node_data_field_view_reference.field_image_data AS node_data_field_view_reference_field_image_data,
node.type AS node_type,
node.vid AS node_vid,
node_revisions.body AS node_revisions_body,
node_revisions.format AS node_revisions_format,
node.title AS node_title,
RAND() AS _random
FROM drupal_node node
LEFT JOIN drupal_content_type_sidebar_last node_data_field_view_reference ON node.vid = node_data_field_view_reference.vid
LEFT JOIN drupal_node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE (node.type in ('sidebar_last')) AND (node_data_field_view_reference.field_view_reference_view_id = '11')
ORDER BY _random ASC
Is this even possible?
Greetings
hamu
Comments
Comment #1
danielb commentedIt should be, but it is entirely possible that the way the viewreference field is exposed to views is insufficient for a filter argument. That wasn't something I specifically looked at. Drupal 6... oh boy... :/
Comment #2
hamuchen commentedI know, Drupal 6. But it's an "old" project getting a redesign.
I looked into the "drupal_content_type_xxx" table and found a difference between node refence and view reference.
Node reference:
- field name: field_node_referece
- column name: field_node_referece_nid
- value (as you expected): 199, 84...
View reference:
- field name: field_view_reference
- column name: field_view_reference_view_id
- value: xyz_view:page_1
It's not a view id (vid), it's the views name + page.
If I type in "xyz_view:page_1" as an argument, it works! But I think, that the value of the column has to be the view_id (like 11, 15...) or only the views name (it's also unique) without the page?!
I try to make a workaround for me (by adding ":page_1" to the argument) and keep you posted.
Greetings
hamu
Comment #3
hamuchen commentedMy Workaround:
custom.module
I had to split the code to a module, because "views_get_page_view()" wont work in arguments.
Greetings
hamu
Comment #4
danielb commented