docs

Various Yii 3.0 related documentation

View the Project on GitHub yiisoft/docs

018 - Widgets

Unlike regular classes, widgets are used in view templates, so syntax is important. It should be both easy to write, easy to read and not too verbose because similar constructs are meant to be used over and over again.

Class names

Widgets aren’t postfixed or prefixed.

Inheritance

Inheritance is allowed with some restrictions:

Immutability

Widgets should:

Methods

Names

Boolean flags

The Method that corresponds to boolean attribute should be named after the attribute and accept a boolean flag argument.