0
我有一種情況,我必須在詞彙表視圖的上下文過濾器中添加0-9鏈接Drupal的7次如何修改where子句?
如何更改where子句部分? 我需要改變
SUBSTRING(node.title, 1, :node_title) = :node_title1
到
SUBSTRING(node.title, 1, 1) =REGEXP ('[0-9]')
如果某些價值== '0-9' 我試圖執行hook_views_query_alter,但它不工作
function custom_views_query_alter(&$view, &$query){
$current_view=&$view;
switch($current_view->name){
case 'glossary':
if($query->where[0]['conditions'][0]['value'][':node_title1']=='0-9'){
$query->where[0]['conditions'][0]['field']= "SUBSTRING(node.title, 1, 1) =REGEXP ('[0-9]')";
echo "YES";
dpm($query->where);
} } }