yii\gii\controllers\DefaultController::actionPreview PHP Метод

actionPreview() публичный Метод

public actionPreview ( $id, $file )
    public function actionPreview($id, $file)
    {
        $generator = $this->loadGenerator($id);
        if ($generator->validate()) {
            foreach ($generator->generate() as $f) {
                if ($f->id === $file) {
                    $content = $f->preview();
                    if ($content !== false) {
                        return '<div class="content">' . $content . '</div>';
                    } else {
                        return '<div class="error">Preview is not available for this file type.</div>';
                    }
                }
            }
        }
        throw new NotFoundHttpException("Code file not found: {$file}");
    }