yii2-dialog A notification dialog management system for Yii 2 using bootstrap3-dialog.

  1. Demo
  2. Installation
  3. Usage
  4. Report
  5. License
  6. Resources

Stable Version Unstable Version Total Downloads Monthly Downloads Daily Downloads

A widget component for Yii Framework 2.0 to easily configure and initialize popup notification dialog boxes. It provides a polyfill for the native javascript alert, confirm, and prompt dialog boxes. It includes inbuilt support for rendering rich dialog boxes via bootstrap3-dialog which makes using Bootstrap's modal more monkey-friendly. The key features provided by the library are:

  • Control how you want to render JAVASCRIPT dialogs. Inbuilt quick support for following dialog types:
    • ALERT dialog
    • CONFIRM dialog
    • PROMPT dialog
    • CUSTOM dialog
  • Includes a jQuery plugin krajeeDialog (created by Krajee), that allows one to configure the bootstrap3-dialog library easily, or use the native JS alerting component, OR also configure any third party JS Notification Library to be used.
  • Advanced configuration via kartik\dialog\Dialog widget. This widget allows one to globally setup the native JS alert OR bootstrap3-dialog settings.

Demo

You can see detailed documentation and demonstration on usage of the extension.

Installation

The preferred way to install this extension is through composer.

Either run:

$ php composer.phar require kartik-v/yii2-dialog "*"

or add:

"kartik-v/yii2-dialog": "*"

to the require section of your composer.json file.

Usage

Basic Usage

In your view you can load the asset bundle and render the javascript to load the bootstrap 3 modal dialog.

// view.php
use kartik\dialog\DialogAsset;
DialogAsset::register($this);
$this->registerJs("\$('#your-btn-id').on('click', function() {
    BootstrapDialog.alert('I want banana!');
});");
Advanced Usage (Widget)

In your view OR view layout file, you can render the widget like this. This will not display any content directly - but will render all the javascript and css needed for initializing the BootstrapDialog as per your customized settings.

// view.php
use kartik\dialog\Dialog;

// Example 1
echo Dialog::widget([
   'libName' => 'krajeeDialog',
   'options => [], // default options
]);

// Example 2
echo Dialog::widget([
   'libName' => 'krajeeDialogCust',
   'options => ['draggable' => true, 'closable' => true], // custom options
]);

Report

License

yii2-dialog is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

Resources

2 0
2 followers
0 downloads
Yii Version: 2.0
License: BSD-2-Clause
Category: User Interface
Developed by: Kartik V
Created on: Feb 22, 2016
Last updated: 8 years ago

Related Extensions