skeeks\cms\widgets\formInputs\StorageImage::run PHP Method

run() public method

public run ( )
    public function run()
    {
        try {
            if (!$this->hasModel()) {
                throw new Exception(\Yii::t('skeeks/cms', "Current widget works only in form with model"));
            }
            if ($this->model->isNewRecord) {
                throw new Exception(\Yii::t('skeeks/cms', "The image can be downloaded after you save the form data"));
            }
            echo $this->render('storage-image', ['model' => $this->model, 'widget' => $this]);
        } catch (\Exception $e) {
            echo Alert::widget(['options' => ['class' => 'alert-warning'], 'body' => $e->getMessage()]);
        }
    }