2017 © Pedro Peláez
 

yii2-extension yii2-modal-alert-widget

Modal alert widget for Yii2

image

pa3py6aka/yii2-modal-alert-widget

Modal alert widget for Yii2

  • Friday, November 17, 2017
  • by pa3py6aka
  • Repository
  • 1 Watchers
  • 0 Stars
  • 54 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 23 % Grown

The README.md

Yii2 Modal Alert Widget

Latest Stable Version License Total Downloads Monthly Downloads Daily Downloads, (*1)

This widget show bootstrap modal or magnific popup when you set session flash message., (*2)

Supports all bootstrap versions - 3,4 and 5., (*3)

For magnific popups you must install magnific js before using this widget - http://dimsemenov.com/plugins/magnific-popup/, (*4)

And for bootstrap modals of course you must set up bootstrap in your project., (*5)

Installation

Install with composer:, (*6)

composer require pa3py6aka/yii2-modal-alert-widget

or add, (*7)

"pa3py6aka/yii2-modal-alert-widget": "^1.4"

to the require section of your composer.json file., (*8)

Usage

In controller set flash message:, (*9)

Yii::$app->session->setFlash('success', 'My Message');

In your layout view show this widget:, (*10)

<?php use pa3py6aka\yii2\ModalAlert; ?>
...
<?= ModalAlert::widget() ?>

By default widget using bootstrap 4 modal. Use type property to switch to another modal type:, (*11)

<?p= ModalAlert::widget(['type' => ModalAlert::TYPE_BOOTSTRAP_5]) ?>

You can set flashes with titles:, (*12)

Yii::$app->session->setFlash('error', [['My Title', 'My Message']]);

Available options

type - Type of alert - bootstrap 3/4/5 jquery or magnific popup, defaults to bootstrap 4. Bootstrap 5 type has two versions - with jQuery enabled and without jQuery. Use declared constants to set type (like ModalAlert::TYPE_BOOTSTRAP_5_JQUERY). See available types in source code., (*13)

popupCssClass - CSS class for modal(popup)., (*14)

popupId - Modal(popup) ID., (*15)

magnificPopupType - Type of magnific popup, defaults to "inline". See available types in official magnific popup guide., (*16)

popupView - Path to your custom view for render modal(popup). You can copy original view from vendor/pa3py6aka/yii2-modal-alert-widget/src/views and customize it., (*17)

showTime - Time in seconds after which the modal window will be automatically closed (0 means that modal will be closed only by user), (*18)

modalSize - Bootstrap Modal size, available size modal-sm, modal-lg, modal-xl, and modal-fullscreen (for Bootstrap 5 only), default to '', (*19)

Example

<?= ModalAlert::widget([
    'popupCssClass' => 'my-custom-class',
    'popupView' => '@app/views/common/my-custom-alert',
]) ?>

Then, set flash:, (*20)

Yii::$app->session->setFlash('error', [['Terrible mistake!', "Sorry, you can't sign up, because your karma is very small"]]);

And we get: Alt text, (*21)

The Versions

17/11 2017

dev-master

9999999-dev

Modal alert widget for Yii2

  Sources   Download

MIT BSD-3-Clause

The Requires

 

yii2 yii 2 modal alert

17/11 2017

1.2.1

1.2.1.0

Modal alert widget for Yii2

  Sources   Download

MIT

The Requires

 

yii2 yii 2 modal alert

16/11 2017

1.1.1

1.1.1.0

Modal alert widget for Yii2

  Sources   Download

MIT

The Requires

 

yii2 yii 2 modal alert

16/11 2017

1.2.0

1.2.0.0

Modal alert widget for Yii2

  Sources   Download

MIT

The Requires

 

yii2 yii 2 modal alert

16/11 2017

1.1.0

1.1.0.0

Modal alert widget for Yii2

  Sources   Download

MIT

The Requires

 

yii2 yii 2 modal alert

14/09 2017

1.0.2

1.0.2.0

Modal alert widget for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 yii 2 modal alert

14/09 2017

1.0.1

1.0.1.0

Modal alert widget for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 yii 2 modal alert

14/09 2017

1.0.0

1.0.0.0

Modal alert widget for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 yii 2 modal alert