CakePHP 3:如何为分页器排序链接添加换行符

CakePHP 3: How to add a line break to Paginator sort links

我想在索引页上的几列中包含换行符。

<thead>
  <tr>
    <th><?= $this->Paginator->sort('name') ?></th>
    <th><?= $this->Paginator->sort('temp', ['label' => 'Temperature (C)']) ?></th>
    <th><?= $this->Paginator->sort('vol', ['label' => 'Volume (m^3)']) ?></th>
  </tr>
</thead>

我希望 "units" 列位于 "unit name" 下方。本质上,我想用“br”标签替换单位前的 space。

理想情况下,这些“th”项应该呈现类似于以下内容:

<th>Temperature<br>(C)</th>
<th>Volume<br>(m^3)</th>

建议?

可以这样做:

<?= $this->Paginator->sort('temp', 'Temperature<br>(C)', ['escape' => false]) ?>

有关在排序链接中使用 html 的示例,请参阅 the documentation