1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,35 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+declare(strict_types=1); |
|
4 |
+ |
|
5 |
+/* |
|
6 |
+* This file is part of newsmailer bundle for Contao. |
|
7 |
+* |
|
8 |
+* (c) Benjamin Roth |
|
9 |
+* |
|
10 |
+* @license LGPL-3.0-or-later |
|
11 |
+*/ |
|
12 |
+ |
|
13 |
+namespace vonRotenberg\NewsmailerBundle\EventListener; |
|
14 |
+ |
|
15 |
+use Contao\CoreBundle\ServiceAnnotation\Callback; |
|
16 |
+use Contao\Database; |
|
17 |
+use Contao\DataContainer; |
|
18 |
+ |
|
19 |
+/** |
|
20 |
+ * @Callback(table="tl_news_archive", target="fields.nc_notification.options") |
|
21 |
+ */ |
|
22 |
+class NewsArchiveNotificationOptionsListener |
|
23 |
+{ |
|
24 |
+ public function __invoke(DataContainer $dc) |
|
25 |
+ { |
|
26 |
+ $arrOptions = array(); |
|
27 |
+ $objNotifications = Database::getInstance()->execute("SELECT id,title FROM tl_nc_notification WHERE type='news_submitted' ORDER BY title"); |
|
28 |
+ |
|
29 |
+ while ($objNotifications->next()) { |
|
30 |
+ $arrOptions[$objNotifications->id] = $objNotifications->title; |
|
31 |
+ } |
|
32 |
+ |
|
33 |
+ return $arrOptions; |
|
34 |
+ } |
|
35 |
+} |