1

有一种方法可以打开列表控制器上的重新排序功能并重新排序列表项name,例如...

但是有一些方法可以在重新排序列表上显示图像而不是文本?

在此处输入图像描述

我现在拥有的:

config_reorder.yaml

title: 'Configurar a ordem'
azuRef: ref
azuImg: image
modelClass: Frama\Azulejos\Models\Azulejo
toolbar:
buttons: reorder_toolbar

重新排序控制器.php

...
public function __construct($controller)
{
    ...

    $this->azuImg = $this->getConfig('azuImg', $this->azuImg);

    ...

}
...

结果当然是我收到了文字...而且我不知道该怎么办...我需要访问路径或(更好)getThumb

在此处输入图像描述


编辑

好的,我可以通过转换一个刺来获得类似的路径:

json_decode($this->reorderGetRecordImg($record))->path

但是如何让拇指工作呢?

4

1 回答 1

1

解决方案

好吧,解决方案很简单,就像 ***k :)

模块/后端/行为/rendercontroller/partials/_records.htm

<?php foreach ($records as $record): ?>
    <!-- ... -->

    <img src="<?= $record->image->getThumb(50,'auto',['mode' => 'landscape']) ?>" alt="">

     <!-- ... -->
<?php endforeach ?>

或者:

模块/后端/行为/rendercontroller/partials/_records.htm

<?php foreach ($records as $record): ?>
    <!-- ... -->

    <img src="<?= $this->reorderGetRecordImg($record) ?>" alt="">

     <!-- ... -->
<?php endforeach ?>

重新排序控制器.php

...
public function __construct($controller)
{
    ...

    $this->azuImg = $this->getConfig('azuImg', $this->azuImg);

    ...

}
...
public function reorderGetRecordImg($record)
{
    return $record->image->getThumb(50,'auto',['mode' => 'landscape']);
}
...
于 2017-03-28T11:27:30.063 回答