I had version 1.2 of this module working, but when I upgraded to 2.1, it stopped returning results. The view structure is as follows:
$view = new view;
$view->name = 'reviews_by_article';
$view->description = 'Displays all Review content that comes from a given Article';
$view->tag = '';
$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('fields', array(
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'field_source_article_nid' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'node',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'break_phrase' => 0,
'not' => 0,
'id' => 'field_source_article_nid',
'table' => 'node_data_field_source_article',
'field' => 'field_source_article_nid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'4' => 0,
'5' => 0,
'6' => 0,
'3' => 0,
),
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'webform' => 0,
'blog' => 0,
'forum' => 0,
'article' => 0,
'issue' => 0,
'notitle' => 0,
'page' => 0,
'promotion' => 0,
'review' => 0,
'story' => 0,
'tip' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'3' => 0,
'4' => 0,
'2' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'review' => 'review',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('items_per_page', 0);
$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('node_content', 'Node content', 'node_content_1');
$handler->override_option('types', array(
'article' => 'article',
));
$handler->override_option('modes', array(
'0' => 'full',
));
$handler->override_option('argument_mode', 'nid');
$handler->override_option('default_argument', '');
If I give it a valid argument, the preview SQL looks like this:
SELECT node.nid AS nid
FROM node node
LEFT JOIN content_type_review node_data_field_source_article ON node.vid = node_data_field_source_article.vid
WHERE (node.type in ('review')) AND (node_data_field_source_article.field_source_article_nid = 30)
If I run that SQL directly in the database, it returns 14 node ids. If I change the row style to fields (instead of nodes), I can get the results to show in the default display (preview) but not in the node content display. Changing the row style back to nodes (which is what I need) gets me an unhelpful AJAX error in the default display and still nothing in the node content display.
I'm going to try downgrading to 1.2 for now. Suggestions welcome!
Comments
Comment #1
benstallings commenteddowngrading to 1.2 fixed the problem, so it's definitely a difference between 1.2 and 2.1. Do I need to run update.php or something? Drupal didn't say anything about needing to do that after I upgraded as it usually does.
Comment #2
Crell commentedThere's no upgrade hook, but you will need to reconfigure your view as the way some options are saved changed somewhere between 1.1 and 2.1. Because most views are stored in code, there's really no way to have an automated upgrade path for that. I believe the release where that happened had a note in the release notes.
Comment #3
benstallings commentedI tried recreating the view from scratch in 2.1 and had the same problem. Do I need to uninstall 1.2 before installing 2.1?
Comment #4
Crell commentedThere is no uninstall hook. You should remove the old code, certainly. :-)