... |
... |
@@ -14,6 +14,14 @@
|
14 |
14 |
*/
|
15 |
15 |
|
16 |
16 |
$GLOBALS['TL_DCA']['tl_article']['config']['onload_callback'][] = array('tl_article_eSM_artLayout','registerSubPalettes');
|
|
17 |
+$GLOBALS['TL_DCA']['tl_article']['config']['onload_callback'][] = array('tl_article_eSM_artLayout','registerSubPalettes');
|
|
18 |
+
|
|
19 |
+/**
|
|
20 |
+ * List
|
|
21 |
+ */
|
|
22 |
+$GLOBALS['TL_DCA']['tl_article']['list']['label']['fields'] = array('title','inColumn','es_type');
|
|
23 |
+$GLOBALS['TL_DCA']['tl_article']['list']['label']['format'] = '%s <span style="color:#b3b3b3;padding-left:3px">[%s]</span> <span style="color:#b3b3b3;padding-left:3px">[%s]</span>';
|
|
24 |
+$GLOBALS['TL_DCA']['tl_article']['list']['label']['label_callback'] = array('tl_article_eSM_artLayout','addLabel');
|
17 |
25 |
|
18 |
26 |
/**
|
19 |
27 |
* Extend default palette
|
... |
... |
@@ -34,7 +42,13 @@ $GLOBALS['TL_DCA']['tl_article']['fields']['es_type'] = array
|
34 |
42 |
'inputType' => 'select',
|
35 |
43 |
'options_callback' => array('tl_article_eSM_artLayout','getArticleLayouts'),
|
36 |
44 |
'eval' => array('chosen'=>true, 'tl_class'=>'w50', 'includeBlankOption'=>true, 'submitOnChange'=>true),
|
37 |
|
- 'sql' => "int(10) unsigned NOT NULL default '0'"
|
|
45 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'",
|
|
46 |
+ 'relation' => array
|
|
47 |
+ (
|
|
48 |
+ 'type' => 'hasOne',
|
|
49 |
+ 'load' => 'lazy',
|
|
50 |
+ 'table' => 'tl_article_layouts'
|
|
51 |
+ )
|
38 |
52 |
);
|
39 |
53 |
|
40 |
54 |
$GLOBALS['TL_DCA']['tl_article']['fields']['es_maxWidth'] = array
|
... |
... |
@@ -122,4 +136,16 @@ class tl_article_eSM_artLayout extends \Backend
|
122 |
136 |
}
|
123 |
137 |
|
124 |
138 |
}
|
|
139 |
+
|
|
140 |
+ public function addLabel($row, $label, \DataContainer $dc, $args)
|
|
141 |
+ {
|
|
142 |
+ $time = \Date::floorToMinute();
|
|
143 |
+ $published = ($row['published'] && ($row['start'] == '' || $row['start'] <= $time) && ($row['stop'] == '' || $row['stop'] > ($time + 60)));
|
|
144 |
+
|
|
145 |
+ $ArticleLayout = \ArticleLayoutsModel::findByPk($row['es_type']);
|
|
146 |
+
|
|
147 |
+ $strLabel = sprintf('%s <span style="color:#b3b3b3;padding-left:3px">[%s]</span> <span class="tl_blue" style="padding-left:3px">[%s]</span>',$row['title'],$GLOBALS['TL_LANG']['COLS'][$row['inColumn']],($ArticleLayout->title ? $ArticleLayout->title : '-'));
|
|
148 |
+
|
|
149 |
+ return '<a href="contao/main.php?do=feRedirect&page='.$row['pid'].'&article='.(($row['alias'] != '' && !Config::get('disableAlias')) ? $row['alias'] : $row['id']).'" title="'.specialchars($GLOBALS['TL_LANG']['MSC']['view']).'" target="_blank">'.Image::getHtml('articles'.($published ? '' : '_').'.gif', '', 'data-icon="articles.gif" data-icon-disabled="articles_.gif"').'</a> '.$strLabel;
|
|
150 |
+ }
|
125 |
151 |
}
|