Noderelationships sets up the ability to do nice js-enabled usability enhancements for cck nodereference fields.However, I had more specific constraints...I needed to customize the view that you use when selecting nodes. Normal arguments and filters don't work when set on noderelationships-based views, provided for your use by the module. I tried using some instructions found on drupal.org ( issue refs here ) to filter by url arguments, etc but it didn't work...however, plain 'ol ( fancy 'ol ) hook_views_pre_view worked like a charm, using $view->default_handler->override_option('filter', $filter = array( {assoc array defining a views filter} ) ); Also, I needed to filter so that previously referenced nodes wouldn't show in the view - single noderef only please. I had to install nodereferrer...Now, node_relationships special treatment of views prevents filters and arguments, but it allows relationships. So you have to set a nodereferrer relationship on the view, then add a filter such that referencing nodes is empty. But the filter doesn't take since node_relationships is doing it's fancy thing. So I ran a views export, copied the resulting filter array, and added another filter in my hook_views_pre_view. I feel like I triumphed...huzzah.
Monday, January 24, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment