doulu6234 2012-03-25 15:17
浏览 17
已采纳

如何更改模块安装上的自动别名设置?

Situation:

  • Drupal 6 node module defining custom content type
  • Necessity to have an automated alias for the content type, e.g. content_type/[title-raw]

Question: How can I programmatically set the Automated alias setting of the new content type to the above pattern in the hook_install?

  • 写回答

1条回答 默认 最新

  • dongrang2140 2012-03-25 16:02
    关注

    Solution is trivial, automated alias patterns of Drupal are stored in variables:

    function hook_install()
    {
        variable_set('pathauto_node_[content_type]_pattern', 'content_type_path/[title-raw]');
    }
    

    where content_type refers to the machine-readable name of the content type and content_type_path is the desired prefix of the alias of the content type.

    The solution was fetched from the post at http://drupal.org/node/1246334#comment-5038566

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料