Skip to content

Commit 554a121

Browse files
tbialczalbozek
authored andcommitted
IBX-9060: Added delete action and delete multiple notifications
1 parent 3e5b9ab commit 554a121

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

src/bundle/Resources/config/routing.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,14 @@ ibexa.notifications.delete:
971971
requirements:
972972
notificationId: '\d+'
973973

974+
ibexa.notifications.delete:
975+
path: /notification/delete/{notificationId}
976+
defaults:
977+
_controller: 'Ibexa\Bundle\AdminUi\Controller\NotificationController::deleteNotificationAction'
978+
methods: [ GET ]
979+
requirements:
980+
notificationId: '\d+'
981+
974982
ibexa.asset.upload_image:
975983
path: /asset/image
976984
options:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/**
4+
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5+
* @license For full copyright and license information view LICENSE file distributed with this source code.
6+
*/
7+
declare(strict_types=1);
8+
9+
namespace Ibexa\AdminUi\Form\Data\Notification;
10+
11+
class NotificationRemoveData
12+
{
13+
private array $notifications;
14+
15+
public function __construct(array $notifications = [])
16+
{
17+
$this->notifications = $notifications;
18+
}
19+
20+
public function getNotifications(): array
21+
{
22+
return $this->notifications;
23+
}
24+
25+
public function setNotifications(array $notifications): void
26+
{
27+
$this->notifications = $notifications;
28+
}
29+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/**
4+
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5+
* @license For full copyright and license information view LICENSE file distributed with this source code.
6+
*/
7+
declare(strict_types=1);
8+
9+
namespace Ibexa\AdminUi\Form\Type\Notification;
10+
11+
use Ibexa\AdminUi\Form\Data\Notification\NotificationRemoveData;
12+
use Symfony\Component\Form\AbstractType;
13+
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
14+
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
15+
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
16+
use Symfony\Component\Form\FormBuilderInterface;
17+
use Symfony\Component\OptionsResolver\OptionsResolver;
18+
19+
class NotificationRemoveType extends AbstractType
20+
{
21+
public function buildForm(FormBuilderInterface $builder, array $options): void
22+
{
23+
$builder->add(
24+
'notifications',
25+
CollectionType::class,
26+
[
27+
'entry_type' => CheckboxType::class,
28+
'required' => false,
29+
'allow_add' => true,
30+
'entry_options' => ['label' => false],
31+
'label' => false,
32+
]
33+
);
34+
35+
$builder->add(
36+
'remove',
37+
SubmitType::class
38+
);
39+
}
40+
41+
public function configureOptions(OptionsResolver $resolver): void
42+
{
43+
$resolver->setDefaults([
44+
'data_class' => NotificationRemoveData::class,
45+
]);
46+
}
47+
}

0 commit comments

Comments
 (0)