Detail_Load_Frontend
A trait for handling article details and view loading in a frontend application
This trait provides functionality for loading and displaying article details, as well as handling view loading with additional data preparation.
Methods
detail
Loads and displays the details of an article.
The pretty URL of the article to display
Whether to render the page for printing
If true, returns the rendered view as a string instead of outputting it
This method performs the following tasks:
- Retrieves general data such as language and login status
- Fetches the article by its pretty URL
- Checks language compatibility and redirects if necessary
- Retrieves related articles
- Prepares SEO data
- Loads module data
- Renders the detail view or returns it as a string
load_view
Loads and renders a view with additional data preparation.
The name of the view to load
An array of data to pass to the view
This method:
- Prepares OpenAI-related data
- Sets up SEO and Open Graph data
- Handles cookie warnings
- Prepares menu items and translations
- Loads and renders the specified view along with header and footer
getOpenaiData
Prepares OpenAI-related data for use in views.
The existing data array to augment with OpenAI data
The augmented data array containing OpenAI-related information
This method:
- Retrieves page settings for conditional OpenAI display
- Fetches available languages and language lines
- Retrieves and processes OpenAI prompts
- Determines the preselected language
- Gets the last chat ID