I am brand new to October and, coming from a Wordpress background, I absolutely love October.
But because I am new, please excuse my newbyness and lack of proper terminology.
I have used the Builder plugin to create (in Wordpress or Drupal terms) a custom content type and a few fields.
I have created a Model and Controller for the List and Form to display the custom content type in the backend.
Is it possible in either the Form or List to have a link to (pre)view an entry on the front-end? I do see in the Form Controller properties that there is a Property called "Preview record page > Page title", but I am having trouble figuring out what to enter there, and if I did, would this achieve what I would like.
Thanks ahead of time.....
Ok, I am the OP and figured out how to solve my question and I thought I would document the solution to my question for other people that may need this in future.
Is it possible in either the Form or List to have a link to (pre)view an entry on the front-end?
A - Create a partial file that contains the code to show the entry
plugins/my/listing/models/listing (Change to suit your site)
Create a file called:
my-view-entry.htm (Could be any name)
In it paste the code (change as desired, key point here is to use <?php echo $record->slug ?> to get the slug for each entry/record in the list):
<a class="btn btn-sm btn-info" href="https://[your site]/listing/<?php echo $record->slug ?>" target="_blank">View</a>
This assumes as an example, that you have a Page called Listing with URL: /listing/:slug. Change as needed.
B - Add a column to the Model > List
Go to Admin > Builder
Open your plugin
This will show Lists > columns.yaml
Add a column
FIELD - Enter eg "View"
LABEL - Enter eg "View"
TYPE - Partial
PATH - Enter a valid URL that points to the file that contains code to show/view the entry Eg:
Done eh! Guess where I am from :)
Cheers and happy holidays.
hey i want to create a model for save the form but i dont know where to create the model please help me out
I was also looking for a solution to this problem and couldn't figure it out. Your suggestion to "Create a partial file" needs to be my default thought when trying to solve a problem.
Thanks for the help
1-4 of 4