Preview Modules
Hey how do you go about previewing modules? There is not a lot of documentation available. How do you handle route. When you click on the route that is generated by the backend for instance http://localhost:9000/en/pages/intro the result is not found. If i add a route which routes to the view located at the /site/modulename.blade.php it returns an error $item not found.
7 Replies
hi @.zeenux there's no route needed to preview inside the CMS, it is returning the view with a
$item
variable which is the previewed record. Now of course you'll want a route in your frontend routes to access the record, but if you want to use the same view for the preview and the frontend site, you'll need to send a $item variable from your frontend controller to that same view.I can't preview when i click on the generated link? It returns file not found.
the generated link is customizable and needs to have a corresponding route in your frontend, I was talking about the "Preview changes" link
you may not want 'pages' in your frontend url for example, so for that you should use
setPermalinkBase('')
then you need to think about how you are managing the locale slug in your frontend routesThanks @ifox.dev. as a side note how do you access the attached files in the $item collection? dd doesn't show them.
$item->files('name_of_your_field_name')
@foreach ($item->filesList('video') as $f )