Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在drupal中创建默认视图_Drupal_Drupal 6_Drupal Views_Drupal Modules - Fatal编程技术网

在drupal中创建默认视图

在drupal中创建默认视图,drupal,drupal-6,drupal-views,drupal-modules,Drupal,Drupal 6,Drupal Views,Drupal Modules,我想从mymodule创建一个默认视图。我想使用两个表中的字段。我的基本表是users。显示usres的所有字段。我还需要Draagabaleu结构中的字段。我查看了hook\u视图\u数据。draagabaleviews组已在视图中。那么我如何加入该表 function mymodule_views_default_views() { $view = new view; $view->name = 'my_view'; $view->description = ''; $view-

我想从mymodule创建一个默认视图。我想使用两个表中的字段。我的基本表是users。显示usres的所有字段。我还需要Draagabaleu结构中的字段。我查看了hook\u视图\u数据。draagabaleviews组已在视图中。那么我如何加入该表

function mymodule_views_default_views() {
$view = new view;
$view->name = 'my_view';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; 
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(

));
$handler->override_option('fields', array(

  'name' => array(
  'label' => 'Username',
  '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' => 0,
  'exclude' => 0,
  'id' => 'name',
  'table' => 'users',
  'field' => 'name',
  'override' => array(
    'button' => 'Override',
  ),
  'relationship' => 'none',
 ),
'status' => array(
  'label' => 'Status',
  '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_user' => 0,
  'overwrite_anonymous' => 0,
  'anonymous_text' => '',
  'exclude' => 0,
  'id' => 'status',
  'table' => 'users',
  'field' => 'status',
  'override' => array(
    'button' => 'Override',
  ),
  'relationship' => 'none',
 ),

'Last access' => array(
  'label' => 'Last access',
  '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_user' => 0,
  'overwrite_anonymous' => 0,
  'anonymous_text' => '',
  'exclude' => 0,
  'id' => 'Last access',
  'table' => 'users',
  'field' => 'access',
  'override' => array(
    'button' => 'Override',
  ),
  'relationship' => 'none',
  ),
 'order' => array(
  'label' => 'Order',
  '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,
  ),
  'set_precision' => FALSE,
  'precision' => 0,
  'decimal' => '.',
  'separator' => ',',
  'prefix' => '',
  'suffix' => '',
  'exclude' => 0,
  'id' => 'order',
  'table' => 'draggableviews_structure',
  'field' => 'value',
  'relationship' => 'none',         
 ),
));
$handler->override_option('sorts', array(
'order' => array(
  'order' => 'ASC',
  'id' => 'Order',
  'table' => 'draggableviews_structure',
  'field' => 'value',
  'override' => array(
    'button' => 'Override',
  ),
  'relationship' => 'none',
 ),

 ));
 $handler->override_option('arguments', array(

));
$handler->override_option('access', array(
'type' => 'perm',
'perm' => 'Allow Reordering',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('empty', 'This book page doesn\'t contain any sub pages.');
$handler->override_option('empty_format', '1');
$handler->override_option('items_per_page', 20);
$handler->override_option('use_pager', '1');
$handler->override_option('style_plugin', 'draggabletable');
$handler->override_option('style_options', array(
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
  'title' => 'title',
  'name' => 'name',            
),
'info' => array(
  'title' => array(
    'sortable' => 0,
    'separator' => '',
  ),
  'name' => array(
    'sortable' => 0,
    'separator' => '',
  ),

),

'tabledrag_order' => array(
  'field' => 'order',
  'handler' => 'native',
),
'draggableviews_extensions' => array(
  'extension_top' => '3',
  'extension_bottom' => '3',
),
'tabledrag_order_visible' => array(
  'visible' => 1,
),
'tabledrag_hierarchy_visible' => array(
  'visible' => 0,
),
'draggableviews_depth_limit' => '0',
'draggableviews_repair' => array(
  'repair' => 'repair',
),
'tabledrag_types_add' => 'Add type',
'tabledrag_expand' => array(
  'expand_links' => 'expand_links',
  'collapsed' => 0,
  'by_draggableviews_structure' => 0,
),
'tabledrag_lock' => array(
  'lock' => 0,
),
'draggableviews_default_on_top' => '1',
'draggableviews_button_text' => 'Save order',
'draggableviews_arguments' => array(
  'use_args' => 0,
),
'draggableviews_book_radios' => '1',
'draggableviews_book_argument' => 'p',
'draggableviews_book_filter' => 'none',
));
 $handler = $view->new_display('page', 'Page', 'page_1');
 $handler->override_option('path', 'user/reorder');
 $handler->override_option('menu', array(
'type' => 'tab',
'title' => 'Rearrange',
'description' => 'Organize your book pages.',
'weight' => '10',
'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
 ));

 $views[$view->name] = $view;
 return $views;
}

我遇到了同样的问题,我需要加入视图中的两张表。幸运的是我找到了这些链接

模块使用节点引用字段的反向关系增强视图

您可能还需要

这些都是由模块提供的。因此,如果您想以编程的方式做同样的事情,那么您需要查看反向节点引用模块