我编写了一个自定义视图处理程序,将消息私有标记为0或1或2; any是她的标签[MARK_READ,ARK_NEW,...]的价值:
function mydevel_views_data() {
$data['mydevel']['table']['group'] = t('mydevel');
$data['mydevel']['table']['join'] = array(
// Exist in all views.
'#global' => array(),
);
$data['mydevel']['mydevel_isnewmessage'] = array(
'title' => t('is new message field'),
'help' => t('is new message field.'),
'field' => array(
'handler' => 'mydevel_handler_field_isnewmessage',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'mydevel_handler_filter_isnewmessage',
),
);
并写了一个正常工作的归档处理程序; message_mark函数在mydevel模块文件中写入并且当前工作;如果消息是新的,则标记为#34;现在":
class mydevel_handler_field_isnewmessage extends views_handler_field_numeric {
var $field_alias = 'mydevel_field_isnewmessage';
function query() {
}
function option_definition() {
$options = parent::option_definition();
//dsm($this);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
}
function get_value($values, $field = NULL) {
return intval(message_mark($values->mid, $values->message_timestamp));
}
function render($values) {
$value = $this->get_value($values);
$value_theme = theme('mark', array('type' => $value));
return $value_theme;
}
}
现在,我想编写一个视图过滤器处理程序,在数字模式[0或1或2]上或在检查列表模式[all,read,new,updated]上过滤该字段。但我不想在过滤器处理程序上覆盖查询功能,并希望使用添加到视图文件中的此公共处理程序归档(mydevel_handler_filter_isnewmessage)返回的值。可以通过扩展标准视图处理程序来写这个想法吗?我做什么亲爱的?我写了这个但不行:这是返回错误
class mydevel_handler_filter_isnewmessage extends views_handler_filter_numeric {
var $always_multiple = TRUE;
function option_definition() {
$options = parent::option_definition();
return $options;
}
function operators() {
$operators = parent::operators();
return $operators;
}
function query() {
}
}
坦克你很多。