OctoberCMS How to Preview

- 1 answer

Ad

I have a controller implements Backend\Behaviors\FormController and Backend\Behaviors\ListController I'm able to update or delete selected records from the list (delete by clicking the delete button and update by double click), however, I can't find a way to add preview link to the list and I can't find that mentioned in the documentation. Maybe the answer is easy but I'm still missing it.

I'm able to preview any records if I enter the preview link manually in the URL bar. e.g.

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

I just want to add the above preview link next to each record in the list.

Thanks in advanced.

Ad

Answer

Ad

Based on the comments above, the only way to do it is by list partials:

You should define custom list column, quoting 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
Ad
source: stackoverflow.com
Ad