在Drupal 7中更改消息 [英] Alter messages in Drupal 7

查看:115
本文介绍了在Drupal 7中更改消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

drupal有几条消息。当有一个php警告时,会出现错误消息,但是模块也可以使用drupal_set_message()来引发消息。问题是:有办法改变这些信息吗?例如,在每个消息中用'b'替换每个'a'。



谢谢!

解决方案

虽然没有设置消息,可以通过 hook_preprocess_status_messages 在显示中更改它们,参见 http://api.drupal.org/api/drupal/includes--theme.inc/function / theme / 7 进行预处理和 http ://api.drupal.org/api/drupal/includes--theme.inc/function/theme_status_messages/7



编辑:你也可以尝试字符串覆盖检查 http://api.drupal。 org / api / drupal / includes - bootstrap.inc / function / t / 7 ,简称 $ conf ['locale_custom_strings_en'] ['some message'] ='some messbge'; fo r英语,如果不是英文,请更改 _en 以获取其他内容。


There is a couple of messages in drupal. When there is a php warning, an error message is raised, but a module can also raise messages with drupal_set_message(). The question is: Is there a way to alter these messages? For example to replace every 'a' with 'b' in every message.

Thanks!

解决方案

While there is no message alter on set, you can change them on display via hook_preprocess_status_messages, see http://api.drupal.org/api/drupal/includes--theme.inc/function/theme/7 on preprocess and http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_status_messages/7 .

Edit: also you can try string overrides check http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/t/7 , in short $conf['locale_custom_strings_en']['some message'] = 'some messbge'; for English, change _en for something else if it's not English.

这篇关于在Drupal 7中更改消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆