Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - <?php
 - /***************************************************************
 - * Copyright notice
 - *
 - * (c) 2013 Stephan Schuler <[email protected]>
 - *
 - * 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!
 - ***************************************************************/
 - /**
 - * A Storage backend
 - *
 - * @package Nxl10nhelpers
 - * @subpackage Persistence\Storage
 - */
 - class Tx_Nxl10nhelpers_Persistence_Storage_Typo3DbBackend extends Tx_Extbase_Persistence_Storage_Typo3DbBackend {
 - /**
 - * Builds the language field statement
 - *
 - * In contrast to the parent::addSysLanguageStatement() method, this one allows
 - * for having native language records that are no language overlays, too. No
 - * matter if the target record is default language, "all" or native, all of those
 - * are required to have the l10n_parent field poiting to "0", which indicates
 - * that they are no overlay records.
 - *
 - * @param string $tableName The database table name
 - * @param array &$sql The query parts
 - * @return void
 - */
 - protected function addSysLanguageStatement($tableName, array &$sql) {
 - if (is_array($GLOBALS['TCA'][$tableName]['ctrl'])) {
 - if(isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField']) && $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== NULL) {
 - $allowedLanguages = array_unique(array(0, -1, (int) $GLOBALS['TSFE']->sys_language_uid, (int) $GLOBALS['TSFE']->sys_language_content));
 - $sql['additionalWhereClause'][] = $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . ' IN (' . join(',', $allowedLanguages) . ')';
 - }
 - if(isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']) && $GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'] !== NULL) {
 - $sql['additionalWhereClause'][] = $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'] . ' = 0';
 - }
 - }
 - }
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment