/** * Construct. * * @param \Widget $widget The form widget. * @param \FormModel $formModel Optional the corresponding form model. */ public function __construct(\Widget $widget, \FormModel $formModel = null) { $this->widget = $widget; $this->formModel = $formModel; $this->attributes = new Attributes(); $this->container = new Container(); $this->label = new Label(); $this->errors = new Errors($widget->getErrors()); $this->widgetType = WidgetUtil::getType($widget); }