所以,我在uc_orders表中序列化了数据。这个数据有几个感兴趣的参数,我想从中创建一个独特的字段。
这些$ data值中的每一个都可以自行运行。显然我正在重写第二个声明的价值。如何两次引用相同的数据位置,以便可以使用这两个字段,并且可以将所有序列化数据分解到单独的字段中?
function uc_order_views_data() {
$data['uc_orders']['data'] = array(
'group' => t('Order') . ':data',
'title' => t('Arrival Date'),
'help' => t('Arrival date choosen by customer during checkout.'),
'field' => array(
'handler' =>'uc_order_handler_field_arrive_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
);
$data['uc_orders']['data'] = array(
'group' => t('Order') . ':data',
'title' => t('Ship Date'),
'help' => t('The date to ship the order by.'),
'field' => array(
'handler' =>'uc_order_handler_field_ship_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
);
}
答案 0 :(得分:2)
我终于找到了答案。
$data['uc_orders']['data2'] = array(
'group' => t('Order') . ':data',
'title' => t('Arrival Date'),
'real field' => 'data',
'help' => t('Arrival date choosen by customer during checkout.'),
'field' => array(
'handler' =>'uc_order_handler_field_arrive_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
);
$data['uc_orders']['data'] = array(
'group' => t('Order') . ':data',
'title' => t('Ship Date'),
'help' => t('The date to ship the order.'),
'field' => array(
'handler' =>'uc_order_handler_field_ship_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
);
解决方案是添加'real field' => 'field name',
并更改$ data id。