OctoberCMS 如何预览

OctoberCMS How to Preview

我有一个实现 Backend\Behaviors\FormControllerBackend\Behaviors\ListController 的控制器。我可以从列表中更新或删除选定的记录(通过单击删除按钮删除并通过双击更新),但是,我找不到将预览 link 添加到列表的方法,我可以找不到documentation.

中提到的那个

如果我在 URL 栏中手动输入预览 link,我就可以预览任何记录。例如

http://my-project.dev/administration-backend/walid/my-plugin/model/preview/1

我只想在列表中的每条记录旁边添加上面的预览 link。

根据上面的评论,唯一的方法是通过列表部分:

您应该定义自定义列表列,引用 OctoberCMS documentation:

Partial

partial - renders a partial, the path value can refer to a partial view file otherwise the column name is used as the partial name. Inside the partial these variables are available: $value is the default cell value, $record is the model used for the cell and $column is the configured class object Backend\Classes\ListColumn.

content:
    type: partial
    path: ~/plugins/acme/blog/models/comments/_content_column.htm