<?php /** * @var $json string */ use kernel\models\Option; $table = new \Itguild\Tables\ListJsonTable($json); $table->columns([ 'preview' => function ($data) { return "<img src='$data' width='200px'>"; } ]); $table->addAction(function ($row, $url){ $path = $row['path']; $active_admin_theme = Option::where("key", "active_admin_theme")->first(); $btn = "<a class='btn btn-primary' href='$url/activate/?p=$path' style='margin: 3px; width: 150px;' >Активировать</a>"; if ($path === $active_admin_theme->value){ $btn = "Активна"; } return $btn; }); $table->create(); $table->render();