如何在t()的输出中关闭围绕var的“ <em class =“ placeholder”> </ em>”?


8

在我的模块中,我使用来显示块内的菜单drupal_render(menu_tree('my-menu'))

在输出中,用t()包围的变量被包围<em class="placeholder"> </em>

Drafts <em class="placeholder">(4)</em>
Inbox <em class="placeholder">(2)</em>

如何关闭此功能?

Answers:


12

实际上,文档中对此很好的评论。粘贴此处以保持完整性


有三种样式的占位符:

!variable,指示应按原样插入文本。这对于将变量插入电子邮件等内容很有用。

$message = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => l(t('My account'), "user/$account->uid")));

@variable,它指示文本应通过check_plain运行,以转义HTML字符。将其用于Drupal页中显示的任何输出。

$title = t("@name's blog", array('@name' => $account->name));

%variable,指示该字符串应转义为HTML并使用theme_placeholder()突出显示,默认情况下会突出显示该主题。

$message = t('%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name));

抱歉,我应该检查doc:$而不是搜索HTML:来查找功能:$。THX
Willem de Vries
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.