[TASK] TCA cleanup for TYPO3 7.6
authorAlex Kellner <alexander.kellner@in2code.de>
Sat, 14 Nov 2015 19:58:53 +0000 (20:58 +0100)
committerAlex Kellner <alexander.kellner@in2code.de>
Sat, 14 Nov 2015 19:58:53 +0000 (20:58 +0100)
Get TCA icon path depending on TYPO3 version

Classes/Utility/ConfigurationUtility.php [new file with mode: 0644]
Configuration/TCA/tx_powermailcond_domain_model_condition.php
Configuration/TCA/tx_powermailcond_domain_model_conditioncontainer.php
Configuration/TCA/tx_powermailcond_domain_model_rule.php

diff --git a/Classes/Utility/ConfigurationUtility.php b/Classes/Utility/ConfigurationUtility.php
new file mode 100644 (file)
index 0000000..20cff2a
--- /dev/null
@@ -0,0 +1,58 @@
+<?php
+namespace In2code\PowermailCond\Utility;
+
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2015 in2code.de
+ *  Alex Kellner <alexander.kellner@in2code.de>,
+ *  Oliver Eglseder <oliver.eglseder@in2code.de>
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * ConfigurationUtility class
+ *
+ * @package powermail
+ * @license http://www.gnu.org/licenses/lgpl.html
+ *          GNU Lesser General Public License, version 3 or later
+ */
+class ConfigurationUtility
+{
+
+    /**
+     * Get path to an icon for TCA configuration
+     *
+     * @param string $fileName
+     * @return string
+     */
+    public static function getIconPath($fileName)
+    {
+        $prefix = 'EXT:powermail_cond/';
+        if (!GeneralUtility::compat_version('7.6')) {
+            $prefix = ExtensionManagementUtility::extRelPath('powermail_cond');
+        }
+        $iconPath = $prefix . 'Resources/Public/Icons/' . $fileName;
+        return $iconPath;
+    }
+}
index ef5d911..d12b4d6 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+use In2code\PowermailCond\Utility\ConfigurationUtility;
+
 return array(
        'ctrl' => array(
                'title' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions',
@@ -14,7 +16,7 @@ return array(
                        'starttime' => 'starttime',
                        'endtime' => 'endtime',
                ),
-               'iconfile' => 'EXT:powermail_cond/Resources/Public/Icons/icon_tx_powermailcond_conditions.gif'
+               'iconfile' => ConfigurationUtility::getIconPath('icon_tx_powermailcond_conditions.gif')
        ),
        'interface' => array(
                'showRecordFieldList' => 'sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,
index d583f92..2d9b6b0 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+use In2code\PowermailCond\Utility\ConfigurationUtility;
+
 return array(
        'ctrl' => array(
                'title' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditioncontainer',
@@ -15,7 +17,7 @@ return array(
                        'endtime' => 'endtime',
                ),
                'requestUpdate' => 'form',
-               'iconfile' => 'EXT:powermail_cond/Resources/Public/Icons/icon_tx_powermailcond_conditions.gif'
+               'iconfile' => ConfigurationUtility::getIconPath('icon_tx_powermailcond_conditions.gif')
        ),
        'interface' => array(
                'showRecordFieldList' => 'sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,
index c8a4be0..83b55a1 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+use In2code\PowermailCond\Utility\ConfigurationUtility;
+
 return array(
        'ctrl' => array(
                'title' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules',
@@ -12,7 +14,7 @@ return array(
                        'disabled' => 'hidden'
                ),
                'requestUpdate' => 'ops',
-               'iconfile' => 'EXT:powermail_cond/Resources/Public/Icons/icon_tx_powermailcond_rules.gif'
+               'iconfile' => ConfigurationUtility::getIconPath('icon_tx_powermailcond_rules.gif')
        ),
        'interface' => array(
                'showRecordFieldList' => 'hidden,conditions,title,start_field,ops,cond_string,equal_field',