dsjhejw3232 2009-08-07 17:49
浏览 70
已采纳

drupal钩子函数及其参数

I'm reading through Pro Drupal development right now, and an example on page 82 uses the following function:

function menufun_menu_link_alter(&$item, $menu){  
  if ($item['link_path'] == 'logout'){  
    $item['link_title'] = 'Sign off';  
  }
}

I understand that I can find out what parameters "hook_menu_link_alter" takes by looking at api.drupal.org. What I don't understand is how I'm supposed to find out what $item actually contains. In this example, $item['link_path'] and $item['link_title'] were both used - how did he know they existed?

I'm not only interested in this specific example, of course. I want to be able to do this for any function that I look at in drupal.

Thanks in advance for the help!

  • 写回答

3条回答 默认 最新

  • doudao1950 2009-08-07 17:53
    关注

    If you went to api.drupal.org and looked up hook_menu_link_alter, you'd get this page:

    http://api.drupal.org/api/function/hook_menu_link_alter/6

    Which includes the following note:

    "$item Associative array defining a menu link as passed into menu_link_save()."

    If you follow the link to the menu_link_save page, you'd be here:

    http://api.drupal.org/api/function/menu_link_save/6

    In which the contents of the $item parameter is clearly listed under Parameters.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?