PHP code example of siripravi / yii2-modal

1. Go to this page and download the library: Download siripravi/yii2-modal library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

siripravi / yii2-modal example snippets


public function actionModalTest()
{
    $footer = Html::button('Close', ['class' => 'btn btn-secondary', 'data-dismiss' => 'modal']);

    $model = new ModelForm();

    if ($model->load(Yii::$app->request->post()) && $model->save()) {
        Yii::$app->session->setFlash('success', 'Success');
    } else {
        $footer .= Html::submitButton('Ok', ['class' => 'btn btn-primary']);
    }

    $data = [
        'title' => 'Title',
        'body' => $this->renderAjax('modal-test', [
            'model' => $model,
        ]),
        'footer' => $footer,
    ];

    return Json::encode($data);
}

use himiklab\yii2\recaptcha\ReCaptcha;

echo ReCaptcha::widget();

$js = <<<JS
if (typeof grecaptcha !== 'undefined') {
    recaptchaOnloadCallback();
}
JS;
$this->registerJs($js);

php composer.phar