docs icon indicating copy to clipboard operation
docs copied to clipboard

Document how to override views of anything in the backend (widgets, controllers, etc)

Open LukeTowers opened this issue 8 months ago • 2 comments

In Winter it's very easy to override specific view files for anything that uses the ViewMaker trait.

\Backend\Widgets\Filter::extend(function ($widget) {
     $widget->addViewPath(__DIR__ . '../widgets/filter/partials');
});

now you can override any existing partial or even provide a new partials for that widget. You can also get fancier by controlling when exactly you call addViewPath() and on which specific instances of whichever class you're trying to override. The above example was placed in a controller's constructor in order to only extend the filter widget for that specific controller, but it could have easily been placed in the index() method to further limit, or various events could have been listened to in order to further limit the overriding of the partials.

^

TODO: Document that in an easy to find and easy to read way. @damsfx @WebVPF any suggestions?

LukeTowers avatar Jun 26 '24 07:06 LukeTowers