chervand / yii-dashboard-modal
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/chervand/yii-dashboard-modal
This package is not auto-updated.
Last update: 2025-10-29 14:08:56 UTC
README
/** @var YDModalWidget $modal */
$modal = $this->widget('YDModalWidget', [
	'actions' => [
		'edit' => $this->createUrl('modalEdit'),
		'delete' => $this->createUrl('modalDelete'),
	],
]);
...
'columns' => [
		...
		[
			'type' => 'raw',
			'htmlOptions' => ['class' => 'grid-icon'],
			'value' => function ($model) use ($modal) {
				return $modal->link(
					'<i class="fa fa-trash-o text-danger"></i>',
					$modal->createActionUrl('deleteMenuItem', $model, 'name'),
					['title' => Yii::t('app', 'Delete')]
				);
			}
		],
		...
	],
...
public function actions()
	{
		return [
			'modalEdit' => [
				'class' => 'YDModalActionEdit',
				'modalView' => 'menu/_modalEdit',
				'formId' => 'form-edit',
				'models' => [
					'model' => [
						'class' => 'Model',
						'pk' => 'id'
					],
				],
				'afterSubmit' => function () {
                    $this->redirect('afterSave');
                }
			],
			'modalDelete' => [
				'class' => 'YDModalActionDelete',
				'modalView' => '_modalDelete',
				'formId' => 'form-delete',
				'models' => [
					'model' => [
						'class' => 'Model',
						'pk' => ['id1', 'id2', 'id3']
					],
				],
				'afterSubmit' => function () {
                    $this->redirect('afterDelete');
                }
			],
		];
	}
req YDActiveForm