1. Go to this page and download the library: Download rft/yii2-alert-modal-widget 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/ */
rft / yii2-alert-modal-widget example snippets
<?= \frontend\components\widgets\AlertModalWidget::widget([
'triggerSelector' => '.modal-delete-trigger',
'title' => 'Delete Confirmation',
'body' => 'This item will be deleted permanently.',
'iconType' => 'warning',
'iconColor' => '#f8bb86',
'confirmButtonLabel' => 'Delete',
'confirmButtonClass' => 'alert-modal-btn-confirm btn-danger', // Base class + color class
])
<?= Html::a('<i class="fa fa-eye"></i> View', ['/item/view', 'id' => 1], [
'class' => 'btn btn-info modal-view-trigger', // Your button styles + trigger class
'data' => [
'alert-modal-title' => 'View Item Details',
'alert-modal-body' => 'Are you sure you want to view this item?',
'alert-modal-confirm-label' => 'Yes, View Details',
],
])
// Your trigger buttons use normal Bootstrap classes:
'class' => 'btn bg-gradient-danger btn-xs modal-delete-trigger'
// The modal trigger class is just added to the end
<?= Html::csrfMetaTags()
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.