Extensions:News Widget

From Lorekeeper Wiki
Revision as of 16:20, 28 September 2023 by Liwoyadan (talk | contribs) (Creation of the news widget extension...!)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
News Widget
Description A widget that displays the most recent news.
Author(s) Min
Status Stable
Github ext/news-widget
LK Version 2.1.0






A small extension. Displays a widget on the logged-in dashboard that will show the most recently created/updated news and optionally a truncated text preview. By default the widget displays the two most recent news but can be configured for more. The widget is called with @include('widgets._news', ['textPreview' => true]) and can be used elsewhere (i.e. in a sidebar) as long as the $newses variable is declared on respective pages.

Installation

Pull the branch; resolve any conflicts if necessary and run php artisan update-extension-tracker. There are no migrations in this extension.

Configuration

Setting the 'textPreview' variable to true will show a 300 character long preview of the respective news along with a read more link at the end. Setting it to false will only display the title, posting, and editing date of the news. To configure how many news are displayed, in app\Http\Controllers\HomeController.php in the first function in the file edit the '2' in 'newses' => News::visible()->orderBy('updated_at', 'DESC')->take(2)->get(), to however many news you'd like to be displayed. The widget itself can be edited and styled in resources\views\widgets\_news.blade.php.

Usage

Images

Troubleshooting

I can be found in the Lorekeeper server!

See Also