Current Path : /data/web/virtuals/51568/virtual/www/subdom/pomucky/src/form/ |
Current File : /data/web/virtuals/51568/virtual/www/subdom/pomucky/src/form/BaseField.php |
<?php namespace app\form; use app\Model; abstract class BaseField { public $model; public $attribute; abstract public function renderInput(): string; public function __construct(Model $model, string $attribute) { $this->model = $model; $this->attribute = $attribute; } public function __toString() { return sprintf(' <div id="field-%s" class="form-group mb-2"> <label>%s</label> %s <div id="invalid-%s" class="invalid-feedback">%s</div> </div> ', $this->attribute, $this->model->getLabel($this->attribute), $this->renderInput(), $this->attribute, $this->model->getFirstError($this->attribute) ); } }