Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Hide translated records in link browser. Fixes #40 #41

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Classes/Browser/RecordBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public function displayRecordsForPage($selectedPage, $tables, $urlParameters)
$this->urlParameters = $urlParameters;
$this->urlParameters['mode'] = 'db';
$this->expandPage = $selectedPage;
// unset languageField to hide record translations in link browser
unset($GLOBALS['TCA'][$tables]['ctrl']['languageField']);
return $this->renderTableRecords($tables);
}

Expand Down
38 changes: 38 additions & 0 deletions Classes/Hooks/RecordListGetTableHook.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
namespace Cobweb\Linkhandler\Hooks;

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Backend\RecordList\RecordListGetTableHookInterface;

/**
* Interface for classes which hook into \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList
* and do additional getTable processing
*/
class RecordListGetTableHook implements RecordListGetTableHookInterface
{
/**
* modifies the DB list query
*
* @param string $table The current database table
* @param int $pageId The record's page ID
* @param string $additionalWhereClause An additional WHERE clause
* @param string $selectedFieldsList Comma separated list of selected fields
* @param \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList $parentObject Parent \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList object
* @return void
*/
public function getDBlistQuery($table, $pageId, &$additionalWhereClause, &$selectedFieldsList, &$parentObject) {
$additionalWhereClause .= ' AND (sys_language_uid<=0 OR l10n_parent = 0)';
}
}
5 changes: 5 additions & 0 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@

// Register migration controller
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = \Cobweb\Linkhandler\Command\LinkMigrationCommandController::class;

if (TYPO3_MODE === 'BE') {
// Register for hook to modify the DB list query
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable']['tx_linkhandler'] = \Cobweb\Linkhandler\Hooks\RecordListGetTableHook::class;
}