简体   繁体   English

Drupal:整个分类学词汇视图的路径

[英]Drupal: path for entire taxonomy vocabulary view

What's the path to display all nodes belonging to a vocabulary ? 显示属于词汇表的所有节点的路径是什么?

In other words, I want to display all terms at once. 换句话说,我想一次显示所有术语。 (I don't want to filter by term, just show all nodes tagged with any term of a vocabulary (我不想按术语进行过滤,只需显示所有标记有词汇表中任何术语的节点

You can do this pretty easily by grabbing a copy of views and using an appropriate filter. 您可以通过获取视图副本并使用适当的过滤器来轻松完成此操作。 Heck, you can do it where the vid is part of the path, so it works for all of the vocabularies. 哎呀,您可以在vid是路径的一部分的地方进行操作,因此它适用于所有词汇表。 Hold on... 坚持,稍等...

Yeah, I thought so. 是的,我是这么认为的。 Here's a view I made recently that does this - just copy/paste this into the view import. 这是我最近制作的一个执行此操作的视图-只需将其复制/粘贴到视图导入中即可。

$view = new view;
$view->name = 'vocabulary';
$view->description = 'Displays all nodes in a vocabulary';
$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('sorts', array(
  'sticky' => array(
    'order' => 'DESC',
    'id' => 'sticky',
    'table' => 'node',
    'field' => 'sticky',
    'relationship' => 'none',
  ),
  'created' => array(
    'order' => 'DESC',
    'granularity' => 'second',
    'id' => 'created',
    'table' => 'node',
    'field' => 'created',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'vid' => array(
    'default_action' => 'not found',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '%1',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'id' => 'vid',
    'table' => 'vocabulary',
    'field' => 'vid',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '3' => 0,
      '4' => 0,
      '5' => 0,
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_fixed' => '',
    'default_argument_user' => 0,
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'blog' => 0,
      'poll' => 0,
      'faq' => 0,
      'forum' => 0,
      'event' => 0,
      'link' => 0,
      'page' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
      '5' => 0,
      '3' => 0,
      '6' => 0,
      '4' => 0,
      '7' => 0,
      '8' => 0,
      '9' => 0,
      '10' => 0,
      '11' => 0,
      '12' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_node_flag_name' => '*relationship*',
    'validate_argument_node_flag_test' => 'flaggable',
    'validate_argument_node_flag_id_type' => 'id',
    'validate_argument_user_flag_name' => '*relationship*',
    'validate_argument_user_flag_test' => 'flaggable',
    'validate_argument_user_flag_id_type' => 'id',
    '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('cache', array(
  'type' => 'none',
));
$handler->override_option('use_pager', '1');
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
  'relationship' => 'none',
  'build_mode' => 'teaser',
  'links' => 1,
  'comments' => 1,
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'vocabulary/%');
$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',
));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM