如何在drupal主题函数中通过引用传递参数?
我有 drupal 模块“MyMod”
在钩子块中我有:
case 'view': switch ($delta) { //other cases case 6: $block['cache']=BLOCK_NO_CACHE; $blcok['subject']=""; $block['content'] = theme('rss_feeds',$blcok['subject']); return $block; }
在MyMod_theme中:
function MyMod_theme(){ return array( 'rss_feeds' => array( 'arguments' =>array('Subject' =>NULL), ), ); }
而我的themes_rss_feeds是:
function theme_rss_feeds(&$Subject){...}
现在我在管理/报告/事件中不断收到此错误
theme_rss_feeds() 的参数 1 预期为参考,值在 /var/www/staging/htdocs/includes/theme.inc 第 656 行给出
如何通过引用这个主题函数来传递参数?
感谢您的帮助
I have drupal module "MyMod"
in hook block i have:
case 'view': switch ($delta) { //other cases case 6: $block['cache']=BLOCK_NO_CACHE; $blcok['subject']=""; $block['content'] = theme('rss_feeds',$blcok['subject']); return $block; }
and in MyMod_theme:
function MyMod_theme(){ return array( 'rss_feeds' => array( 'arguments' =>array('Subject' =>NULL), ), ); }
and my themes_rss_feeds is:
function theme_rss_feeds(&$Subject){...}
now i am keep getting this error in admin/reports/event
Parameter 1 to theme_rss_feeds() expected to be a reference, value given in /var/www/staging/htdocs/includes/theme.inc on line 656
how to pass parameter by reference to this theme function??
Thanks for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能。这是不可能的。
然而,无论如何你都不希望这样。相反,您想要删除 &来自 Nikit 建议的函数定义。
You can not. It is impossible.
However, you don't want that anyway. Instead, you want to remove the & from the function definition as suggested by Nikit.