For example, you have a status attribute in your model, and you want always to display the status with a green o red light.
One use of the decorator pattern is to implement method to "decorate" some attributes, for example:
class AccountDecorator extends Account
{
public function getStatus()
{
return "<i class="fa fa-circle '.($this->status?"green-class":"red-class"). ' "></i>";
}
}
My question is about more complex blocks of HTML, I don’t feel confortable with contacting everthing into a variable and returning it.
How can be done in Yii2?