在迷你面板中与 %keyword 连接
Concatenation with %keyword in mini-panels
有人发布了另一个问题 https://drupal.stackexchange.com/questions/195860/how-does-one-concatenate-fields-in-title-field-in-panels-pages 但它对我不起作用。
在迷你面板中添加节点字段时,我需要将自定义文本作为前缀与 %node:field_city_title 关键字连接。
我尝试了 Event in %node:field_city_title
、 Event in%node:field_city_title
并进行了很多搜索,但对我没有任何帮助。
如果你有任何想法,请告诉我
我已经想通了,但不确定它是否是标准方法,但我相信覆盖标题字段不被接受 "prefix or postfix" 对于 %keyword
就像问题中提到的那样。
解决方案
1) 从问题的附加图片中删除了标签 h1。
2) 创建了名为 panels-pane--event-node-title.tpl.php
的新 tpl 并在其中添加了一些代码
<div class="pane-content">
<?php if ($title): ?>
<h1> <?php print $title; ?> </h1>
<?php else : ?>
// Here we can set any prefix or postfix within the tag
<h1> Event in <?php print render($content); ?> </h1>
<?php endif; ?>
</div>
$content 变量将获取字段的内容及其所有设置(ID、class、标签等)
希望这会对某人有所帮助。谢谢
有人发布了另一个问题 https://drupal.stackexchange.com/questions/195860/how-does-one-concatenate-fields-in-title-field-in-panels-pages 但它对我不起作用。
在迷你面板中添加节点字段时,我需要将自定义文本作为前缀与 %node:field_city_title 关键字连接。
我尝试了 Event in %node:field_city_title
、 Event in%node:field_city_title
并进行了很多搜索,但对我没有任何帮助。
如果你有任何想法,请告诉我
我已经想通了,但不确定它是否是标准方法,但我相信覆盖标题字段不被接受 "prefix or postfix" 对于 %keyword
就像问题中提到的那样。
解决方案
1) 从问题的附加图片中删除了标签 h1。
2) 创建了名为 panels-pane--event-node-title.tpl.php
的新 tpl 并在其中添加了一些代码
<div class="pane-content">
<?php if ($title): ?>
<h1> <?php print $title; ?> </h1>
<?php else : ?>
// Here we can set any prefix or postfix within the tag
<h1> Event in <?php print render($content); ?> </h1>
<?php endif; ?>
</div>
$content 变量将获取字段的内容及其所有设置(ID、class、标签等)
希望这会对某人有所帮助。谢谢