从 Drupal 7 中的模块调用 $site_name 变量
我正在创建一个自定义模块,该模块使用表单 API 并在提交时发送电子邮件 - 但是,我希望将“发件人”电子邮件名称设为站点名称(例如,
非常感谢! 马特
I'm creating a custom module that has uses the form API and sends an email on submission- however, I want to make the 'from' email name to be the site name (eg, <My Drupal Site> [email protected]). In phptemplate you can use $site_name, but that doesn't work from a module it seems. I've tried calling &$variables or &$variable or &$vars in the function argument and DSMed it but still nothing. Any ideas?
Many thanks!
Matt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用:
模块或模板文件中的任何位置:)
You can use:
anywhere in a module or template file :)
我建议在核心中使用的方法:
在
variable_get()
中包含默认值是一个很好的做法。I'd suggest the approach used in core:
It's good practice to include the default value in
variable_get()
.完成...我挖掘了集合并获取了代码,但没有一个被清理过...清理序列化对象可能会破坏东西,所以这是有道理的
Done...I dug through the set and get code and none of it ever is sanitized...sanitizing serialized objects would probably break stuff so it makes sense