This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I am attempting to concatenate two columns on the reorder page within the backend. To efficiently reorder the items, my client should need to know the name and the status of that particular item. I know that in the list YAML file I can use the concat function as I have done so on the past like this:
select: concat(first_name, ' ', last_name)
I hoped this would work similar on the reorder config YAML file as well. As it stands this is my config_reorder.yaml file:
title: 'Reorder Canines'
nameFrom: concat(name, ' - ', status)
modelClass: Langley\P1k9\Models\Canines
toolbar:
buttons: reorder_toolbar
I can use the name column and I can use the status column separately, but when I try to concatenate them the list is blank.
I hoped this Github pull request would be sufficient to solving my problems.
Is there any possible way to add both columns to the reorder list?
I have found a solution here: https://octobercms.com/forum/post/namefrom-to-use-with-multiple-columns#post-9436
in controllers use:
public function reorderGetRecordName($record)
{
if ($record->pic)
$img = new ImageResizer($record->pic->getPath());
else
$img = new ImageResizer();
$config = [];
$config['pic'] = $img->resize(150, 200, [ 'mode' => 'crop' ]);
$config['name'] = $record->{$this->nameFrom};
return $this->makePartial('reorder_pic', $config);
}
and see other method in: modules/backend/behaviors/ReorderController.php
Last updated
1-3 of 3