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?
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
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
Related Questions
Ad
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad