Fixed bug #16443: FAL Hooks (Thanks to Mathias Schreiber)
authorSteffen Kamper <info@sk-typo3.de>
Tue, 30 Nov 2010 10:24:59 +0000 (10:24 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Tue, 30 Nov 2010 10:24:59 +0000 (10:24 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9682 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tceforms.php
t3lib/core_autoload.php
t3lib/interfaces/interface.t3lib_tceforms_dbfileiconshook.php [new file with mode: 0644]
typo3/sysext/cms/tslib/content/class.tslib_content_content.php

index 31c332c..3014135 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-11-30  Steffen Kamper  <steffen@typo3.org>
 
+       * Fixed bug #16443: FAL Hooks (Thanks to Mathias Schreiber)
        * Fixed bug #16459 Add uid of overlay record to rootline (Thanks to Mathias Schreiber)
 
 2010-11-30  Steffen Gebert  <steffen@steffen-gebert.de>
index f9864a9..2a3ec1f 100644 (file)
@@ -3760,6 +3760,31 @@ class t3lib_TCEforms {
                        $thumbnails = '';
                }
 
+                       // Hook: dbFileIcons_postProcess (requested by FAL-team for use with the "fal" extension)
+               if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['dbFileIcons'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['dbFileIcons'] as $classRef) {
+                               $hookObject = t3lib_div::getUserObj($classRef);
+
+                               if (!($hookObject instanceof t3lib_TCEforms_dbFileIconsHook)) {
+                                       throw new UnexpectedValueException(
+                                               '$hookObject must implement interface t3lib_TCEforms_dbFileIconsHook',
+                                               1290167704
+                                       );
+                               }
+
+                               $additionalParams = array(
+                                       'mode' => $mode,
+                                       'allowed' => $allowed,
+                                       'itemArray' => $itemArray,
+                                       'onFocus' => $onFocus,
+                                       'table' => $table,
+                                       'field' => $field,
+                                       'uid' => $uid
+                               );
+                               $hookObject->dbFileIcons_postProcess($params, $selector, $thumbnails, $icons, $rightbox, $fName, $uidList, $additionalParams, $this);
+                       }
+               }
+
                $str = '<table border="0" cellpadding="0" cellspacing="0" width="1">
                        ' . ($params['headers'] ? '
                                <tr>
index db33a15..865a5e5 100644 (file)
@@ -131,6 +131,7 @@ $t3libClasses = array(
        't3lib_pageselect_getrecordoverlayhook' => PATH_t3lib . 'interfaces/interface.t3lib_pageselect_getrecordoverlayhook.php',
        't3lib_pageselect_getpageoverlayhook' => PATH_t3lib . 'interfaces/interface.t3lib_pageselect_getpageoverlayhook.php',
        't3lib_singleton' => PATH_t3lib . 'interfaces/interface.t3lib_singleton.php',
+       't3lib_tceforms_dbfileiconshook' => PATH_t3lib . 'interfaces/interface.t3lib_tceforms_dbfileiconshook.php',
        't3lib_tceformsinlinehook' => PATH_t3lib . 'interfaces/interface.t3lib_tceformsinlinehook.php',
        't3lib_tcemain_checkmodifyaccesslisthook' => PATH_t3lib . 'interfaces/interface.t3lib_tcemain_checkmodifyaccesslisthook.php',
        't3lib_tcemain_processuploadhook' => PATH_t3lib . 'interfaces/interface.t3lib_tcemain_processuploadhook.php',
diff --git a/t3lib/interfaces/interface.t3lib_tceforms_dbfileiconshook.php b/t3lib/interfaces/interface.t3lib_tceforms_dbfileiconshook.php
new file mode 100644 (file)
index 0000000..c9cca1a
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 Andy Grunwald <andreas.grunwald@wmdb.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 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.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  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!
+ ***************************************************************/
+
+
+/**
+ * Interface for classes which hook into t3lib_TCEforms and do additional dbFileIcons processing
+ *
+ * @author     Andy Grunwald <andreas.grunwald@wmdb.de>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+interface t3lib_TCEforms_dbFileIconsHook {
+
+       /**
+        * Modifies the parameters for selector box form-field for the db/file/select elements (multiple)
+        *
+        * @param       array                   $params                         An array of additional parameters, eg: "size", "info", "headers" (array with "selector" and "items"), "noBrowser", "thumbnails"
+        * @param       string                  $selector                       Alternative selector box.
+        * @param       string                  $thumbnails                     Thumbnail view of images. Only filled if there are images only. This images will be shown under the selectorbox.
+        * @param       array                   $icons                          Defined icons next to the selector box.
+        * @param       string                  $rightbox                       Thumbnail view of images. Only filled if there are other types as images. This images will be shown right next to the selectorbox.
+        * @param       string                  $fName                          Form element name
+        * @param       array                   $uidList                        The array of item-uids. Have a look at t3lib_TCEforms::dbFileIcons parameter "$itemArray"
+        * @param       array                   $additionalParams       Array with additional parameters which are be available at method call. Includes $mode, $allowed, $itemArray, $onFocus, $table, $field, $uid. For more information have a look at PHPDoc-Comment of t3lib_TCEforms::dbFileIcons
+        * @param       t3lib_TCEforms  $parentObject           parent t3lib_TCEforms object
+        * @return      void
+        */
+       public function dbFileIcons_postProcess(array &$params, &$selector, &$thumbnails, array &$icons, &$rightbox, &$fName, array &$uidList, array $additionalParams, t3lib_TCEforms $parentObject);
+}
+
+?>
\ No newline at end of file
index c3fc3d7..5f3360c 100644 (file)
@@ -118,6 +118,14 @@ class tslib_content_Content extends tslib_content_Abstract {
                                                }
 
                                                if (is_array($row)) { // Might be unset in the sys_language_contentOL
+                                                               // Call hook for possible manipulation of database row for cObj->data
+                                                       if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content_content.php']['modifyDBRow']))     {
+                                                               foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content_content.php']['modifyDBRow'] as $_classRef)     {
+                                                                       $_procObj = t3lib_div::getUserObj($_classRef);
+                                                                       $_procObj->modifyDBRow($row, $conf['table']);
+                                                               }
+                                                       }
+
                                                        if (!$GLOBALS['TSFE']->recordRegister[$conf['table'] . ':' . $row['uid']]) {
                                                                $this->cObj->currentRecordNumber++;
                                                                $cObj->parentRecordNumber = $this->cObj->currentRecordNumber;
@@ -175,4 +183,4 @@ if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/conte
        include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_content.php']);
 }
 
-?>
\ No newline at end of file
+?>