十月 CMS |在重新排序列表中显示图像
October CMS | display images on reordering lists
有一种方法可以打开列表控制器上的重新排序功能,并通过 name
重新排序列表项...
但是有一些方法可以在再订购列表中显示图像而不是文本吗?
我目前拥有的:
config_reorder.yaml
title: 'Configurar a ordem'
azuRef: ref
azuImg: image
modelClass: Frama\Azulejos\Models\Azulejo
toolbar:
buttons: reorder_toolbar
ReorderController.php
...
public function __construct($controller)
{
...
$this->azuImg = $this->getConfig('azuImg', $this->azuImg);
...
}
...
当然,我收到了文本……我不知道该怎么办……我需要访问路径或(更好)getThumb
编辑
好的,我可以通过转换刺痛来获得类似的路径:
json_decode($this->reorderGetRecordImg($record))->path
但是如何让拇指起作用呢?
解决方案
好吧,解决方案很简单 ***k :)
modules/backend/behaviors/rendercontroller/partials/_records.htm
<?php foreach ($records as $record): ?>
<!-- ... -->
<img src="<?= $record->image->getThumb(50,'auto',['mode' => 'landscape']) ?>" alt="">
<!-- ... -->
<?php endforeach ?>
或:
modules/backend/behaviors/rendercontroller/partials/_records.htm
<?php foreach ($records as $record): ?>
<!-- ... -->
<img src="<?= $this->reorderGetRecordImg($record) ?>" alt="">
<!-- ... -->
<?php endforeach ?>
ReorderController.php
...
public function __construct($controller)
{
...
$this->azuImg = $this->getConfig('azuImg', $this->azuImg);
...
}
...
public function reorderGetRecordImg($record)
{
return $record->image->getThumb(50,'auto',['mode' => 'landscape']);
}
...
有一种方法可以打开列表控制器上的重新排序功能,并通过 name
重新排序列表项...
但是有一些方法可以在再订购列表中显示图像而不是文本吗?
我目前拥有的:
config_reorder.yaml
title: 'Configurar a ordem'
azuRef: ref
azuImg: image
modelClass: Frama\Azulejos\Models\Azulejo
toolbar:
buttons: reorder_toolbar
ReorderController.php
...
public function __construct($controller)
{
...
$this->azuImg = $this->getConfig('azuImg', $this->azuImg);
...
}
...
当然,我收到了文本……我不知道该怎么办……我需要访问路径或(更好)getThumb
编辑
好的,我可以通过转换刺痛来获得类似的路径:
json_decode($this->reorderGetRecordImg($record))->path
但是如何让拇指起作用呢?
解决方案
好吧,解决方案很简单 ***k :)
modules/backend/behaviors/rendercontroller/partials/_records.htm
<?php foreach ($records as $record): ?>
<!-- ... -->
<img src="<?= $record->image->getThumb(50,'auto',['mode' => 'landscape']) ?>" alt="">
<!-- ... -->
<?php endforeach ?>
或:
modules/backend/behaviors/rendercontroller/partials/_records.htm
<?php foreach ($records as $record): ?>
<!-- ... -->
<img src="<?= $this->reorderGetRecordImg($record) ?>" alt="">
<!-- ... -->
<?php endforeach ?>
ReorderController.php
...
public function __construct($controller)
{
...
$this->azuImg = $this->getConfig('azuImg', $this->azuImg);
...
}
...
public function reorderGetRecordImg($record)
{
return $record->image->getThumb(50,'auto',['mode' => 'landscape']);
}
...