'OctoberCMS How to Preview
I have a controller that 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.
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.
Solution 1:[1]
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 pathvalue
can refer to apartial
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 objectBackend\Classes\ListColumn
.content: type: partial path: ~/plugins/acme/blog/models/comments/_content_column.htm
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Walid Ammar |