访问主页时显示以下错误消息:
Strict Standards: Only variables should be passed by reference in C:\wamp\www\vb-15-05-2018-2\sites\all\modules\vb_ymlp\vb_ymlp.module on line 40
这来自自定义模块,if
语句中的行是问题所在。这是指向更大的问题还是有一个简单的解决方案?
function vb_ymlp_block_view($delta = ""){
module_load_include('inc', 'vb_ymlp', 'vb_ymlp.form');
$block = array();
if($delta == 'vb_ymlp_block'){
// the line below is causing this error
$block['content'] = drupal_render(drupal_get_form('vb_ymlp_form'));
}
return $block;
}
答案 0 :(得分:1)
您无法将值设置为设置drupal_render()
您必须先获取它,然后将其设置为内容变量
就像你必须做的那样
function vb_ymlp_block_view($delta = ""){
module_load_include('inc', 'vb_ymlp', 'vb_ymlp.form');
$block = array();
if($delta == 'vb_ymlp_block'){
// the line below is causing this error
$content = drupal_get_form('vb_ymlp_form');
$content = drupal_render($content);
$block['content'] = $content;
}
return $block;
}
希望这能解决你的问题
感谢