沃梦达 / 编程问答 / php问题 / 正文

在 Drupal 7 中更改消息

Alter messages in Drupal 7(在 Drupal 7 中更改消息)

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

问题描述

drupal 中有几条消息.当出现 php 警告时,会引发错误消息,但模块也可以使用 drupal_set_message() 引发消息.问题是:有没有办法改变这些消息?例如,将每条消息中的每个a"替换为b".

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.

谢谢!

推荐答案

虽然现场没有消息更改,但您可以通过 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 .

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 .

您也可以尝试字符串覆盖检查 http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/t/7 ,简而言之 $conf['locale_custom_strings_en']['some message'] ='some messbge'; 为英文,如果不是英文,请将 _en 更改为其他内容.

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 中更改消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在 Drupal 7 中更改消息

基础教程推荐