<?php /** * ArtLayout for Contao * * Copyright (c) 2016 Benjamin Roth * * @link http://www.esales-media.de * @license commercial */ /** * Add operations button to tl_theme */ array_insert($GLOBALS['TL_DCA']['tl_theme']['list']['operations'],count($GLOBALS['TL_DCA']['tl_theme']['list']['operations'])-1,array ( 'artLayout' => array ( 'label' => &$GLOBALS['TL_LANG']['tl_theme']['artLayout'], 'href' => 'table=tl_article_layouts', 'icon' => 'themes.gif', 'button_callback' => array('tl_theme_eSM_artLayout', 'editArticleLayouts') ) )); /** * Provide miscellaneous methods that are used by the data configuration array. * * @author Benjamin Roth <http://www.esales-media.de> */ class tl_theme_eSM_artLayout extends \Backend { /** * Import the back end user object */ public function __construct() { parent::__construct(); $this->import('BackendUser', 'User'); } /** * Return the "edit article layouts" button * * @param $row * @param $href * @param $label * @param $title * @param $icon * @param $attributes * * @return string */ public function editArticleLayouts($row, $href, $label, $title, $icon, $attributes) { 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)).' '; } }