Browse code

Modernize and adjust code to Contao 5

Benjamin Roth authored on26/10/2023 15:21:49
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,36 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of eSales Media ContentHelperBundle
5
+ *
6
+ * (c) Benjamin Roth
7
+ *
8
+ * @license proprietary
9
+ */
10
+
11
+/*
12
+ * Modify palettes
13
+ */
14
+
15
+use Contao\CoreBundle\DataContainer\PaletteManipulator;
16
+
17
+foreach ($GLOBALS['TL_DCA']['tl_article']['palettes'] as $key => $palette)
18
+{
19
+    if ($key != '__selector__')
20
+    {
21
+        PaletteManipulator::create()->addField('hideInArticleList','teaser', PaletteManipulator::POSITION_AFTER)->applyToPalette($key,'tl_article');
22
+    }
23
+}
24
+
25
+/*
26
+ * Add fields
27
+ */
28
+
29
+$GLOBALS['TL_DCA']['tl_article']['fields']['hideInArticleList'] = array
30
+(
31
+    'label'                   => &$GLOBALS['TL_LANG']['tl_article']['hideInArticleList'],
32
+    'exclude'                 => true,
33
+    'inputType'               => 'checkbox',
34
+    'eval'                    => array('tl_class'=>'w50'),
35
+    'sql'                     => "char(1) NOT NULL default ''"
36
+);