PHPackages                             devgroup/yii2-admin-modals - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. devgroup/yii2-admin-modals

ActiveYii2-extension[Admin Panels](/categories/admin)

devgroup/yii2-admin-modals
==========================

Display your admin actions in bootstrap modals with frames and callbacks

0421JavaScript

Since Jun 2Pushed 8y ago3 watchersCompare

[ Source](https://github.com/DevGroup-ru/yii2-admin-modals)[ Packagist](https://packagist.org/packages/devgroup/yii2-admin-modals)[ RSS](/packages/devgroup-yii2-admin-modals/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 Admin Modals
=================

[](#yii2-admin-modals)

Display your admin actions in bootstrap modals with frames and callbacks.

**Current status:** Work in progress.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist devgroup/yii2-admin-modals "*"

```

or add

```
"devgroup/yii2-admin-modals": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

### 1. Configure application

[](#1-configure-application)

Add `DevGroup\AdminModals\components\AdminModals` component with component id `adminModals`.

Modify your main web application config:

```
return [
    // your app config here
    // ...

    'components' => [
        'adminModals' => [
            'class' => 'DevGroup\AdminModals\components\AdminModals',
            'layoutFile' => '@app/actions/views/empty-layout',
        ],
        // your other app components
    ],
];
```

`AdminModals` components has the following params:

- **layoutFile***(required)* - The path to simplified layout file without your headers, footers, containers etc. This layout is used when your action is rendered inside modal's frame.
- **magicParamKey** and **uniqueParamKey** - Names of GET parameters that are used for communicating between JS part and yii2 backend.

### 2. Add `admin-modals` action

[](#2-add-admin-modals-action)

Admin-modals action is used for displaying simple empty page inside modal's frame during loading the needed route.

You can show loader spinner there.

By default JS part of yii2-admin-modals will load '/site/admin-modal'. That could be configured later.

For adding action modify your Controller actions() function:

```
    public function actions()
    {
        return [
            // other actions here...

            'admin-modal' => [
                'class' => DevGroup\AdminModals\actions\EmptyPageAction::class,
                'viewFile' => '@DevGroup/AdminModals/views/admin-modal',
                'layoutFile' => '@app/actions/views/empty-layout',
            ]
        ];
    }
```

`EmptyPageAction` takes the following params:

- **layoutFile** - The same as in `AdminModalsBehavior` but is not required. If not set - the default controller layout will be used.
- **viewFile** - The view file location for empty page. By default sample view is used. The only requirement to this view file is to include form tag with `admin-modal__frame-form` class that would be used for loading actions with POST method.

### 3. Frontend configuration

[](#3-frontend-configuration)

At first you need to add dependency to `DevGroup\AdminModals\assets\AdminModalsBundle` in you main application AssetBundle:

```
class AppAsset extends AssetBundle
{
    // your stuff here

    public $depends = [
        // add dependency
        DevGroup\AdminModals\assets\AdminModalsBundle::class,
    ];
}
```

If you need to configure JS-part of yii2-admin-modals - add javascript object before AdminModalsBundle loads(for example after opening body tag):

```
window.AdminModalsSettings = {
    modalActionSelector: '.admin-modal-trigger',
    dataAttribute: 'adminModals',
    adminModalPageUrl: '/site/admin-modal',
    adminModalFrameFormSelector: '.admin-modal__frame-form',
    magicParamKey: '__admin_modals',
    adminModalsUniqueParamKey: '__admin-modals__unique-id'
}
```

### 4. Use your modals

[](#4-use-your-modals)

All links and buttons with `admin-modal-trigger` class assigned will automatically call opening modal windows instead of direct action performing.

Example code:

```

    Open user #1 edit form in modal!

```

### How to manually trigger modal?

[](#how-to-manually-trigger-modal)

An example for showing confirmation on deletion of jstree node:

```
function confirmDelete(node) {
  AdminModals.modalOpen({
    url: '/category/delete',
    data: {
      id: $(node.reference[0]).data('id')
    },
    method: 'GET',
    closeCallback: function() {
      alert('Thank you!');
    }
  });
  return false;
}
```

That will display `/category/delete?id=###` in modal.

### Helpers

[](#helpers)

#### JsTreeHelper

[](#jstreehelper)

A helper for jstree `DevGroup\AdminModals\helpers\JsTreeHelper` has the following static functions:

- **modalOpen***($route, $method = 'GET', $attributesMapping = \['id' =&gt; 'id'\])* - Used for opening modals on context-menu actions. Attributes mappings describe additional data params to be added to request. Key is the name of target param, value is the key of data attribute of jstree node which stores target value.

TODO
----

[](#todo)

- Implement callback
- Add more events in $ style
- Document all options
- Describe the main concept(iframe -&gt; location|form.submit -&gt; storage events -&gt; extract buttons ...)
- Test app
    - Simple modal demo
    - GridView actions demo (test with pjax too)
    - Deploy live version
    - Codeception functional tests
    - Screenshots and demo-video
- Add cool badges
- Remove console.log
- ???
- PROFIT!!! *and spread the word*

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/19c9303caa5846f2500a35018dcbd3c7f07c74e30efc1bbf7878d54157ab9c4f?d=identicon)[bethrezen](/maintainers/bethrezen)

---

Top Contributors

[![bethrezen](https://avatars.githubusercontent.com/u/260284?v=4)](https://github.com/bethrezen "bethrezen (17 commits)")

---

Tags

adminbootstrapmodalsyii2yii2-adminyii2-backendyii2-bootstrap-modalyii2-extension

### Embed Badge

![Health badge](/badges/devgroup-yii2-admin-modals/health.svg)

```
[![Health](https://phpackages.com/badges/devgroup-yii2-admin-modals/health.svg)](https://phpackages.com/packages/devgroup-yii2-admin-modals)
```

###  Alternatives

[jeroennoten/laravel-adminlte

Easy AdminLTE integration with Laravel

4.0k4.8M43](/packages/jeroennoten-laravel-adminlte)[dmstr/yii2-adminlte-asset

AdminLTE backend theme asset bundle for Yii 2.0 Framework

1.1k1.8M67](/packages/dmstr-yii2-adminlte-asset)[dwij/laraadmin

LaraAdmin is a Open source Laravel Admin Panel / CMS which can be used as Admin Backend, Data Management Tool or CRM boilerplate for Laravel with features like CRUD Generation, Module Manager, Media, Menus, Backups and much more

1.6k68.7k](/packages/dwij-laraadmin)[filament/spatie-laravel-media-library-plugin

Filament support for `spatie/laravel-medialibrary`.

1764.8M125](/packages/filament-spatie-laravel-media-library-plugin)[bezhansalleh/filament-exceptions

A Simple &amp; Beautiful Pluggable Exception Viewer for FilamentPHP's Admin Panel

193195.9k13](/packages/bezhansalleh-filament-exceptions)[filament/infolists

Easily add beautiful read-only infolists to any Livewire component.

1220.8M36](/packages/filament-infolists)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
