It is an little extension for yii2\bootstrap\Modal
If you do not have Composer, you may install it by following the instructions at getcomposer.org.
Append repository to composer.json
:
"repositories": [
{
"type": "git",
"url": "https://github.com/IuriiP/yii2-popajax.git"
}
],
Run update:
composer require iuriip/yii2-popajax
Add to any element:
'class' => 'modal-button',
'modal-href' => <url-to-popup-content>,
'modal-target' => <jQuery selector>,
I.e.
<?= Html::a('<span class="glyphicon glyphicon-eye-open"></span>', "#", [
'title' => Yii::t('app', 'View'),
'class' => 'modal-button',
'modal-href' => $url,
'modal-target' => '#modal'
]);
Then define your modal:
use iuriip\yii2\Popup;
//...
<?php
Popup::begin([
'header' => 'Preview',
'id' => 'modal',
'size' => 'modal-lg',
]);
//...
Popup::end();
?>
//...
You can use a lot the different independent modals over different modal-target
selector.
Append a process loading indicator