Fatal error: Class 'views_plugin_argument_default' not found ?

Events happening in the community are now at Drupal community events on www.drupal.org.
thepocketgeek's picture

I was working on creating a view to list vehicles in a block based on the URL. What I am trying to do is get a list of vehicles to show up based on what category of vehicle the user is currently on.

For instance, if they are looking at a Bloodmobile, I only want Bloodmobiles to show up in the block. The URL looks like category/bloodmobile (with bloodmobile being the argument that is passed). I think the error that I am getting is showing up because that argument is not being passed correctly. I am using taxonomy:term as my argument.

Here is the error message that I am getting:
"An error occurred at /admin/build/views/ajax/preview/vehicle_category_view.

Error Description:
Fatal error: Class 'views_plugin_argument_default' not found in /home/msvehicl/public_html/sites/all/modules/views/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc on line 8"

I really don't think its related to a problem with views, rather a problem with how the argument is being passed. When I type the argument in to preview the View it works. But all I am typing in is the Taxonomy term (i.e. bloodmobiles). I think its looking at the URL and seeing the word Category and breaking.

Any ideas on how to troubleshoot?

I exported the View below:

$view = new view;
$view->name = 'vehicle_sidebar';
$view->description = 'Sidebar List of Vehicles ';
$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' => '',
    'alter' => array(
      'alter_text' => 1,
      'text' => '<h1>[title]</h1>',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'field_main_vehicle_image_fid' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'sidebar_image_linked',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_main_vehicle_image_fid',
    'table' => 'node_data_field_main_vehicle_image',
    'field' => 'field_main_vehicle_image_fid',
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'delta' => array(
    'order' => 'DESC',
    'id' => 'delta',
    'table' => 'node_data_field_series',
    'field' => 'delta',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'name' => array(
    'default_action' => 'not found',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'php',
    'default_argument' => '',
    'validate_type' => 'taxonomy_term',
    'validate_fail' => 'not found',
    'glossary' => 0,
    'limit' => '0',
    'case' => 'none',
    'path_case' => 'none',
    'transform_dash' => 0,
    'add_table' => 0,
    'require_value' => 0,
    'id' => 'name',
    'table' => 'term_data',
    'field' => 'name',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '3' => 0,
      '4' => 0,
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_fixed' => '',
    'default_argument_user' => 0,
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'webform' => 0,
      'blog' => 0,
      'poll' => 0,
      'faq' => 0,
      'panel' => 0,
      'book' => 0,
      'image' => 0,
      'page' => 0,
      'story' => 0,
      'vehicle' => 0,
      'vehicle_series' => 0,
      'vehicle_type' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 1,
      '2' => 0,
      '3' => 0,
    ),
    'validate_argument_type' => 'name',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'vehicle' => 'vehicle',
    ),
    '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', 5);
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'sideviewtest');
$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,
  'name' => 'navigation',
));

Comments

remove the argument

ultimike's picture

Does the error go away when you get rid of the argument?

-mike

Yes. In fact, it disappears

thepocketgeek's picture

Yes. In fact, it disappears once I change it from "Provide Default Argument > Taxonomy Term ID from URL".

I found this article (http://drupalsn.com/learn-drupal/drupal-questions/question-2650) where someone was basically attempting to do the same thing and a solution was provided with PHP code. I tried that substituting their (publications) URL precursor to the argument for my own (category) but that didn't work. Though to be honest, I am not completely sure how the code they suggested (see below) gets the two arguments from the URL.

<?php
if (arg(0) == 'publications' && arg(1) != '') {
  return
arg(1);
}
?>

At least I am making some progress with Views! LOL... Eventually I am going to get this right...

URL?

ultimike's picture

The view takes only one argument, correct?

In your initial post, you said that the url looks like this: www.example.com/category/bloodmobile, where "bloodmobile" is term you want to pass into the argument, correct?

If I'm correct on those two assumptions, then you are correct in using "Taxonomy: term" as your argument. You should also be able to "Provide default argument" and then "PHP Code" of:

return arg(1);

The arg() function simply returns each part of the URL, starting at 0. So, for www.example.com/category/bloodmobile, arg(0) = "category" and arg(1) = "bloodmobile". The code from your previous comment will also work (with a small change) - it just does some URL validation before passing the argument:

if (arg(0) == 'category' && arg(1) != '') {
  return arg(1);
}

Do you get the same error using the PHP code as before?

Is the site available at a URL where I can access it to take a look? The view export won't do me much good unless I also have the content type and taxonomy stuff.

-mike

Ha! I looked at the code you

thepocketgeek's picture

Ha! I looked at the code you supplied and realized that I added the <?php tags when I added that little script. So for my categories that only have one word terms (bloodmobile, bookmobile, etc) the sidebar is now working properly! Huzzah! I have a few categories that have more than one word so their URL's contain hyphens (ie public-safety-vehicle) Those pages are not returning anything even though they ought to.

Here is the link to the page I am working on:

http://www.msvehicles.com/category/bloodmobiles
http://www.msvehicles.com/category/public-safety-vehicles

If you compare those two pages with the live version of those pages (the top of the left sidebar has links to the bloodmobile and public safety vehicle pages) you can see basically what should be returned.

I noticed that there is a setting for "Transform spaces to dashes in URL" with a check box next to it. I tried using that and refreshing the cache but I am still not getting anything to show up on pages with hyphens in the URL.

Also noticed just now that the content is showing up twice. Weird.

I tried (just for kicks)

thepocketgeek's picture

I tried (just for kicks) using an argument without the hyphens and surprise, surprise, it worked. So I can use the view as I originally intended, I just have to leave the hyphens at home. I'm pretty sure there is a cleaner way to do this but I am stoked that I got it kinda-sorta working. If you use the URL without the hyphens its all good (http://www.msvehicles.com/category/public safety vehicles). Now I just need to figure out why its displaying the content twice on the same page...

EDIT: I figure out why it was duplicating. I had been playing with a views attachment that was supposed to add the Series that are associated with a specific category of vehicle. I removed the attachment display and that solved it.

Thanks for taking the time to help me through the problem, guys!

Florida

Group organizers

Group categories

Florida Topics

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: