$need_it_sooner = l(
t('Need it sooner? Click here'),
'need-it-sooner', array(
'attributes' => array(
'class' => array('float-right', 'button', 'button-red'),
'style' => 'float:right;',
))
);
这是我的代码,我想显示它
Need it sooner? Click here.
我能否在 t() 中轻松设置文本样式,还是我必须编写另一个大块来完成此操作?
最佳答案
在 Drupal 7 中,函数 l
将选项数组作为第三个参数。如果您向它传递选项 'html' => TRUE
,它可以接受 HTML。
您也可以通过函数 t
传递 HTML。所以你可以尝试这样做:
$need_it_sooner = l(
t('<strong>Need it sooner?</strong> Click here'),
'need-it-sooner', array(
'attributes' => array(
'class' => array('float-right', 'button', 'button-red'),
'style' => 'float:right;',
),
'html' => TRUE)
);
关于PHP - 加粗 t 内的某些文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50237344/