I'm getting the following error on the pathauto page- admin/build/path/pathauto

warning: Invalid argument supplied for foreach() in /sites/all/modules/view_alias/view_alias.module on line 92.

And none of my views are listed under "Views available for aliasing".

I tried reinstalling, but same issue.

Comments

emackn’s picture

StatusFileSize
new70.33 KB

I need to fix that message.

One thing, do the arguments on the page displays use define the validator options?

If you do, and still have problems, could you export one of your views that you think should work so I can import it.

Thanks.

emackn’s picture

Any update on your issues?

Jboo’s picture

I'm also having this problem. I get the following error messages:

# warning: Cannot use a scalar value as an array in /home/s3/public_html/site.com/modules/view_alias/view_alias.module on line 153.
# warning: Invalid argument supplied for foreach() in /home/s3/public_html/site.com/modules/view_alias/view_alias.module on line 92.

I have the validator options set, and have exported the view below...

$view = new view;
$view->name = 'consumer_reviews';
$view->description = 'Consumer reviews for each make and model';
$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' => 'Review',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
    ),
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'tid' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '%1 Reviews',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'taxonomy_term',
    'validate_fail' => 'empty',
    'break_phrase' => 0,
    'add_table' => 0,
    'require_value' => 0,
    'reduce_duplicates' => 0,
    'set_breadcrumb' => 1,
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'forum' => 0,
      'manufacturer' => 0,
      'model' => 0,
      'page' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '2' => 2,
      '1' => 0,
    ),
    'validate_argument_type' => 'tid',
    'user_argument_type' => '',
    'restrict_user_roles' => 0,
    'user_roles' => array(),
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 25);
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'node/%/reviews');
$handler->override_option('menu', array(
  'type' => 'tab',
  'title' => 'Consumer Reviews',
  'description' => '',
  'weight' => '0',
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));
emackn’s picture

Ok.. im on to something, By mistake, I developed the view_alias upgrade while running the pathauto 6.2.x-dev tree. Fix coming soon.

emackn’s picture

Assigned: Unassigned » emackn
Status: Active » Fixed

Fix is in beta3 release, should be up soon.

Jboo’s picture

Version: 6.x-2.0-beta2 » 6.x-2.0-beta3
Status: Fixed » Active

Thanks for the quick fix. The errors have gone, but in the "View Alias settings" section I just have this without any of my views details:

View , display , on path , with arguments.

Is there something I might have missed?

Thanks again for your help.

emackn’s picture

Ugh! ... I really need to write some tests. ;) Let me look at this real quick.

emackn’s picture

Ok, beta4 should be showing up soon.. Don't know how I did it.. but a block of code was deleted between beta2 and beta3, and that caused the issues.

Jboo’s picture

Version: 6.x-2.0-beta3 » 6.x-2.0-beta4

Thanks for looking at this so quick. I'm now not getting anything listed under the "View Alias settings". I don't even have...View , display , on path , with arguments....listed for some reason.

Flying Drupalist’s picture

I also don't see anything under view alias settings.

emackn’s picture

Can you double check that you are selecting specific vocabularies to use as arguments and specifying a taxonomy argument validator?

Check to see if new release helps. This fixes the warning message when no views are found.

jponch’s picture

I also don't see anything available under "Views Available for Aliasing" and I have my argument Validator set to "Taxonomy term" and my argument type set to "Term ID" so it seems like the view should be available?

mllr’s picture

StatusFileSize
new37.67 KB

I had the same problem with no views available to select. I think I found the solution:
First: the argument has to be an term-id, not a term
Second: be sure to select taxonomy under validator
Both details are stated on the views alias module page under "General Use", but maybe it should be more precise.

I’m using a german language version, so I’m not sure about the terminology. Take a look at the screenshot :-)

frank

jstoller’s picture

@mllr: That is half-true...

I have three views, with 14 displays between them, that all use the same taxonomy for a term-id argument. I noticed that all but one of these views (with one page and one feed display) were showing up under "Views Available for Aliasing". The missing view appeared to be nearly identical to the ones that worked, except for some differences in the sorting options.

I had to use the PHP Code validator on all these views, rather than the Taxonomy Term validator, so when I first started troubleshooting this I couldn't figure out why any of my views were showing up. Then I remembered I had played with the Taxonomy Term validator at one point when I was first setting up the views, earlier in my site development process. So I switched the validator for my missing view to Taxonomy Term, selected the vocabulary I'm using, saved the view, then switched the validator back to PHP Code and saved the view again. After that the two view displays appeared in my alias settings.

I'm glad I found this workaround, but it's a little kludgey. I strongly suggest adding a field to the Term ID argument options in the Views interface itself, allowing users to specify which vocabulary they want to use, rather than restrict their choice of argument validator.

madnomad’s picture

Version: 6.x-2.0-beta4 » 6.x-2.0-beta6
StatusFileSize
new136.25 KB

emackn, thanks for the module - just what I was looking for.

My views aren't showing up on the pathauto config page - admin/build/path/pathauto - under "Views available for aliasing"

I have two arguments - Term ID and Node ID.
Term ID is validated against its vocabulary [see screen shot]
Path is using .../%/%.

I'm using 6.x-2.0-beta6

from #11 above:
>> Can you double check that you are selecting specific vocabularies to use as arguments and specifying a taxonomy argument validator?

What do you mean by "selecting specific vocabularies to use as arguments"?

thanks much.

quicksketch’s picture

Anyone experiencing this issue it *may* be caused by #649824: Typo Causes Overridden Displays not to Work, which will not list any of your views unless your Taxonomy: Term ID arguments on on the Default display.

emackn’s picture

Status: Active » Needs review

Try beta7, it has the fix quicksketch has mentioned.

Methos76’s picture

Line 123 of views.module should be changed to :

$sql = "SELECT DISTINCT(vv.name) FROM {views_view} vv JOIN {views_display} vd ";

old line was

$sql = "SELECT DISTINCT(vv.name) FROM drupal_views_view vv JOIN drupal_views_display vd ";

where table names are hardcoded which produced an error, cause i didn't use the tableprefix 'drupal_'

iamer’s picture

This doesn't work if the views are actually stored in files in a module.
Isn't there a more generic way to list the views and displays without querying the database directly ?

emackn’s picture

Good point, I didn't think about views in code. I wonder is the views_cache has the info I need. Also created a new issue for this, #676004: Support views in code.

Anyway, for right now, there isn't. but you could just save your views so they get into the database, create your aliases, then revert the views. Not ideal, but that gets you the one time creation of aliases for your views.

iamer’s picture

Ok, I posted a patch in the new issue.

denniemans’s picture

How can I get this module working? This is exactly what I need..!

emackn’s picture

Are you having the same issue? Or is this a support request? If so, create a new issue plz.

denniemans’s picture

Got it working by validating the argument to be a taxonomy term!

dzungnova’s picture

Version: 6.x-2.0-beta6 » 6.x-2.0-beta9

I'm using 6.x-2.0-beta9 still same issue. Please help me.
Thanks

emackn’s picture

Added this to the README.txt file on HEAD and project page.

Generating Aliases
View Alias is integrated with pathauto, (admin/build/path/pathauto). So expand "View Alias Settings"
settings fieldset to select the views to alias.

Steps to make a view avaialbe to view_alias:
1. View must exist and have a page display.
2. Under Arguments, View must have an arg of "Taxonomy: TERM ID".
3. Under Validator options:
a. Set Validator to Taxonomy Term, then select your term vocabulary.
b. Set Argument Type to "Term ID"

emackn’s picture

Status: Needs review » Closed (fixed)