Widgets

In the user interface of your web application, you will often have some parts that should be placed on several pages but cannot be simply placed in the layout file, for example, because they should be filled with the data generated by the route being processed. Yii 2 encapsulates this into the concept of a widget, which is essentially a way to render a separate view file with some arbitrary logic attached to it.

Widgets can be very specific, such as some custom-crafted shorthand widget to render a specific button in our user interface, or very abstract, such as the yiiwidgetsListView, widget which encapsulates the activity of rendering a view file repeatedly given an array of data in a list-like fashion.

While it seems like this chapter is the appropriate place to discuss widgets in detail, it's better to wait until Chapter 11, The Grid, when we will have a chance to actually use a widget and see how it can be configured. So, if you are interested, skip to the FEATURE — widgets section of that chapter right now.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.220.83