As described in Creating every widget has two view files whic are responsible for the articles rendering and html. The first will be the view-entry point which will invoke the second one as a livewire component. Main Entry point view
// This will be the view entry point
resources/views/themes/widget_{widget_name}/widgets/{widget_name}.blade.php
And from the main entry point view we will invoke via livewire component as second view which will contain the articles html template. The component we used is front.widget-articles component. Check the AssignmentPage for more details.
For example our entry point view file might look like this:
@section('content')
@livewire('front.widget-articles', ['view' => 'articles'])
@endsection
Which means our second view file which will contains the article html template will be called articles.blade.php and will have the following path:
resources/views/themes/widget_{widget_name}/livewire/articles.blade.php
Now in this second view file (articles.blade.php) we will have two variables defined:
This means that all of the products assigned to the widget will share the same articles view template. This is done for better code-reusability, since we have a lot of widgets which share the same structure.
In cases where an integration is having completely diffrent structure then the one provided in the widget view we might create a separate view for the assigned widget which will be used only for this integration. In order to do this we need to create a widgets folder inside the integration folder with a file inside with the name of the assigned widget for which we want a dedicated view file. For example lets say we assigned a widget with name regular to an the integration extra.shz.de. To have a dedicated view file for this we need to do the following:
resources/views/domains/extra_shz_de/widgets
resources/views/domains/extra_shz_de/widgets/regular.blade.php
resources/views/domains/extra_shz_de/livewire/widget-regular-articles.blade.php
@section('content')
@livewire('front.widget-articles', ['view' => 'widget-regular-articles'])
@endsection
Example:
"view" => [
"layout" => "",
"folder" => "",
"home" => "",
"category" => "",
"magazine" => "",
"article" => "",
"widgets.regular" => "domains.extra_shz_de.widgets.regular",
],
After creating a dedicated view to a widget a label will appear in All Widgets page notifying you this widget has a dedicated view. And if you click on the setting icon the path to the view will be displayed.
