| ... | ... |
@@ -29,7 +29,7 @@ array_insert($GLOBALS['TL_DCA']['tl_theme']['list']['operations'],count($GLOBALS |
| 29 | 29 |
* |
| 30 | 30 |
* @author Benjamin Roth <http://www.esales-media.de> |
| 31 | 31 |
*/ |
| 32 |
-class tl_theme_eSM_artLayout extends Backend |
|
| 32 |
+class tl_theme_eSM_artLayout extends \Backend |
|
| 33 | 33 |
{
|
| 34 | 34 |
|
| 35 | 35 |
/** |
| ... | ... |
@@ -41,6 +41,18 @@ class tl_theme_eSM_artLayout extends Backend |
| 41 | 41 |
$this->import('BackendUser', 'User');
|
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 |
+ /** |
|
| 45 |
+ * Return the "edit article layouts" button |
|
| 46 |
+ * |
|
| 47 |
+ * @param $row |
|
| 48 |
+ * @param $href |
|
| 49 |
+ * @param $label |
|
| 50 |
+ * @param $title |
|
| 51 |
+ * @param $icon |
|
| 52 |
+ * @param $attributes |
|
| 53 |
+ * |
|
| 54 |
+ * @return string |
|
| 55 |
+ */ |
|
| 44 | 56 |
public function editArticleLayouts($row, $href, $label, $title, $icon, $attributes) |
| 45 | 57 |
{
|
| 46 | 58 |
return $this->User->hasAccess('artLayout', 'themes') ? '<a href="'.$this->addToUrl($href.'&id='.$row['id']).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon, $label).'</a> ' : Image::getHtml(preg_replace('/\.gif$/i', '_.gif', $icon)).' ';
|
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,48 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+/** |
|
| 4 |
+ * ArtLayout for Contao |
|
| 5 |
+ * |
|
| 6 |
+ * Copyright (c) 2016 Benjamin Roth |
|
| 7 |
+ * |
|
| 8 |
+ * @link http://www.esales-media.de |
|
| 9 |
+ * @license commercial |
|
| 10 |
+ */ |
|
| 11 |
+ |
|
| 12 |
+ |
|
| 13 |
+/** |
|
| 14 |
+ * Add operations button to tl_theme |
|
| 15 |
+ */ |
|
| 16 |
+array_insert($GLOBALS['TL_DCA']['tl_theme']['list']['operations'],count($GLOBALS['TL_DCA']['tl_theme']['list']['operations'])-1,array |
|
| 17 |
+( |
|
| 18 |
+ 'artLayout' => array |
|
| 19 |
+ ( |
|
| 20 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_theme']['artLayout'], |
|
| 21 |
+ 'href' => 'table=tl_article_layouts', |
|
| 22 |
+ 'icon' => 'themes.gif', |
|
| 23 |
+ 'button_callback' => array('tl_theme_eSM_artLayout', 'editArticleLayouts')
|
|
| 24 |
+ ) |
|
| 25 |
+)); |
|
| 26 |
+ |
|
| 27 |
+/** |
|
| 28 |
+ * Provide miscellaneous methods that are used by the data configuration array. |
|
| 29 |
+ * |
|
| 30 |
+ * @author Benjamin Roth <http://www.esales-media.de> |
|
| 31 |
+ */ |
|
| 32 |
+class tl_theme_eSM_artLayout extends Backend |
|
| 33 |
+{
|
|
| 34 |
+ |
|
| 35 |
+ /** |
|
| 36 |
+ * Import the back end user object |
|
| 37 |
+ */ |
|
| 38 |
+ public function __construct() |
|
| 39 |
+ {
|
|
| 40 |
+ parent::__construct(); |
|
| 41 |
+ $this->import('BackendUser', 'User');
|
|
| 42 |
+ } |
|
| 43 |
+ |
|
| 44 |
+ public function editArticleLayouts($row, $href, $label, $title, $icon, $attributes) |
|
| 45 |
+ {
|
|
| 46 |
+ return $this->User->hasAccess('artLayout', 'themes') ? '<a href="'.$this->addToUrl($href.'&id='.$row['id']).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon, $label).'</a> ' : Image::getHtml(preg_replace('/\.gif$/i', '_.gif', $icon)).' ';
|
|
| 47 |
+ } |
|
| 48 |
+} |