/** * Cosntruct form field. * @param FormHelper $Form Form helper. * @param string $field Field name. */ public function __construct(FormHelper $Form, $field) { parent::__construct('div'); $this->Form = $Form; $this->field = $field; $this->addClass('field'); if ($Form->isInvalid($field)) { $this->addClass('field-error'); } if ($Form->isRequired($field)) { $this->addClass('field-required'); } }