[FEATURE] Display FlexForm settings in the News CE 02/30902/3 master
authorLorenz Ulrich <lorenz.ulrich@visol.ch>
Fri, 23 May 2014 20:15:36 +0000 (22:15 +0200)
committerPatrick Wiggelman <patrickwiggelman@roquin.nl>
Fri, 20 Mar 2015 09:44:56 +0000 (10:44 +0100)
The FlexForm settings of a News/Events plugin should be displayed
like in EXT:news.

Resolves: #59686
Releases: 3.0
Change-Id: I68f092f902e444819afb51225186f98402924a55
Reviewed-on: http://review.typo3.org/30902
Reviewed-by: Patrick Wiggelman <patrickwiggelman@roquin.nl>
Tested-by: Patrick Wiggelman <patrickwiggelman@roquin.nl>
Classes/Hooks/CmsLayout.php [new file with mode: 0644]
Resources/Private/Language/locallang_be.xml [new file with mode: 0644]
ext_localconf.php

diff --git a/Classes/Hooks/CmsLayout.php b/Classes/Hooks/CmsLayout.php
new file mode 100644 (file)
index 0000000..d7655d1
--- /dev/null
@@ -0,0 +1,111 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011 Georg Ringer <typo3@ringerge.org>
+ *  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 2 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!
+ ***************************************************************/
+
+/**
+ * Hook to display verbose information about pi1 plugin in Web>Page module
+ *
+ * @package TYPO3
+ * @subpackage tx_news
+ */
+class Tx_Roqnewsevent_Hooks_CmsLayout extends Tx_News_Hooks_CmsLayout {
+
+       /**
+        * Path to the locallang file
+        * @var string
+        */
+       const LLPATH_NEWSEVENT = 'LLL:EXT:roq_newsevent/Resources/Private/Language/locallang_be.xml:';
+
+       /**
+        * Returns information about this extension's pi1 plugin
+        *
+        * @param array $params Parameters to the hook
+        * @return string Information about pi1 plugin
+        */
+       public function getExtensionSummary(array $params) {
+               $result = $actionTranslationKey = '';
+
+               if ($params['row']['list_type'] == self::KEY . '_pi1') {
+                       $this->flexformData = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
+
+                       // if flexform data is found
+                       $actions = $this->getFieldFromFlexform('switchableControllerActions');
+                       if (!empty($actions)) {
+                               $actionList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(';', $actions);
+
+                               // translate the first action into its translation
+                               $actionTranslationKey = strtolower(str_replace('->', '_', $actionList[0]));
+                               $actionTranslation = $GLOBALS['LANG']->sL(self::LLPATH_NEWSEVENT . 'flexforms_general.mode.' . $actionTranslationKey);
+
+                               $result .= '<pre>' . $actionTranslation . '</pre>';
+
+                       } else {
+                               $result = $GLOBALS['LANG']->sL(self::LLPATH . 'flexforms_general.mode.not_configured');
+                       }
+
+                       if (is_array($this->flexformData)) {
+
+                               switch ($actionTranslationKey) {
+                                       case 'news_list':
+                                       case 'news_detail':
+                                       case 'news_datemenu':
+                                       case 'category_list':
+                                       case 'tag_list':
+                                               return '';
+                                       case 'news_eventlist':
+                                               $this->getStartingPoint();
+                                               $this->getTimeRestrictionSetting();
+                                               $this->getTopNewsRestrictionSetting();
+                                               $this->getOrderSettings();
+                                               $this->getCategorySettings();
+                                               $this->getArchiveSettings();
+                                               $this->getOffsetLimitSettings();
+                                               $this->getDetailPidSetting();
+                                               $this->getListPidSetting();
+                                               break;
+                                       case 'news_eventdetail':
+                                               $this->getSingleNewsSettings();
+                                               $this->getDetailPidSetting();
+                                               break;
+                                       case 'news_eventdatemenu':
+                                               $this->getStartingPoint();
+                                               $this->getTimeRestrictionSetting();
+                                               $this->getTopNewsRestrictionSetting();
+                                               $this->getDateMenuSettings();
+                                               $this->getCategorySettings();
+                                               break;
+                                       default:
+                               }
+
+                               // for all views
+                               $this->getOverrideDemandSettings();
+                               $this->getTemplateLayoutSettings($params['row']['pid']);
+
+                               $result .= $this->renderSettingsAsTable();
+                       }
+               }
+
+               return $result;
+       }
+
+}
\ No newline at end of file
diff --git a/Resources/Private/Language/locallang_be.xml b/Resources/Private/Language/locallang_be.xml
new file mode 100644 (file)
index 0000000..e362922
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <type>module</type>
+               <description>Language labels for the News event extension in the FRONTEND</description>
+       </meta>
+       <data type="array">
+
+               <languageKey index="default" type="array">
+            <label index="flexforms_general.mode.news_eventlist">Event List View</label>
+            <label index="flexforms_general.mode.news_eventdetail">Event Single View</label>
+            <label index="flexforms_general.mode.news_eventdatemenu">Event Date Menu</label>
+               </languageKey>
+
+        <languageKey index="de" type="array">
+            <label index="flexforms_general.mode.news_eventlist">Veranstaltungen Listenansicht</label>
+            <label index="flexforms_general.mode.news_eventdetail">Veranstaltungen Einzelansicht</label>
+            <label index="flexforms_general.mode.news_eventdatemenu">Veranstaltungen Datumsmen├╝</label>
+        </languageKey>
+
+
+       </data>
+</T3locallang>
\ No newline at end of file
index 8c5a9a5..6ed1378 100644 (file)
@@ -4,6 +4,10 @@ if (!defined ('TYPO3_MODE')) {
        die ('Access denied.');
 }
 
+// Page module hook
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['news_pi1'][$_EXTKEY] =
+       'EXT:' . $_EXTKEY . '/Classes/Hooks/CmsLayout.php:Tx_Roqnewsevent_Hooks_CmsLayout->getExtensionSummary';
+
 $GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['switchableControllerActions']['newItems']['--div--'] = 'Events';
 $GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['switchableControllerActions']['newItems']['News->eventList;News->eventDetail'] = 'List view';
 $GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['switchableControllerActions']['newItems']['News->eventDetail'] = 'Detail view';