October CMS | display images on reordering lists

Ad

There are a way to turn ON the reorder functionality on the list controller and re-order list items by name for example...

But there are some way to display images instead of a text on a reorder list?

enter image description here

What I have for now:

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);

    ...

}
...

And as result of course I get text... And I don't know what to do with that... I need to access to path or (better) getThumb

enter image description here


EDIT

Ok I can get a path with something like that, by transforming a sting:

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

But how to make a thumb work?

Ad

Answer

Ad

SOLUTION

Well the solution was easy as ***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 ?>

OR:

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']);
}
...
Ad
source: stackoverflow.com
Ad