fix slider

This commit is contained in:
2024-12-10 11:56:33 +03:00
parent bfeb2d3c56
commit c7549c225f
11 changed files with 50 additions and 11 deletions

View File

@ -1,6 +1,6 @@
<?php
/**
* @var Slider $slider
* @var Slider $model
*/
use kernel\app_modules\slider\models\Slider;

View File

@ -23,6 +23,15 @@ $table->beforePrint(function () {
return IconBtnCreateWidget::create(['url' => '/admin/slider/create'])->run();
});
$entityRelation = new \kernel\EntityRelation();
$additionals = $entityRelation->getEntityRelationsBySlug("slider");
foreach ($additionals as $additional) {
$table->addColumn($additional, $additional, function ($id) use ($entityRelation, $additional) {
return $entityRelation->getAdditionalPropertyByEntityId("slider", $id, $additional);
});
}
$table->columns([
"status" => [
"value" => function ($cell) {

View File

@ -20,6 +20,16 @@ $table->beforePrint(function () use ($slider) {
$btn .= \kernel\widgets\IconBtn\IconBtnDeleteWidget::create(['url' => "/admin/slider/delete/" . $slider->id])->run();
return $btn;
});
$entityRelation = new \kernel\EntityRelation();
$additionals = $entityRelation->getEntityAdditionalProperty("slider", $slider);
foreach ($additionals as $key => $additional) {
$table->addRow($key, function () use ($additional) {
return $additional;
}, ['after' => 'status']);
}
$table->rows([
'status' => (function ($data) {
return \kernel\app_modules\slider\models\Slider::getStatus()[$data];