Don't show hidden collections in metadata view

This commit is contained in:
Sebastian Meyer 2016-05-20 15:36:17 +02:00
parent 73baeba89f
commit 6c785e8849
2 changed files with 35 additions and 8 deletions

View File

@ -1202,7 +1202,7 @@ class tx_dlf_helper {
}
/* The $labels already contain the translated content element, but with the index_name of the translated content element itself
/* $labels already contains the translated content element, but with the index_name of the translated content element itself
* and not with the $index_name of the original that we receive here. So we have to determine the index_name of the
* associated translated content element. E.g. $labels['title0'] != $index_name = title. */
@ -1210,7 +1210,7 @@ class tx_dlf_helper {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid',
$table,
'pid='.$pid.' AND index_name="'.$index_name.'"'.self::whereClause($table),
'pid='.$pid.' AND index_name="'.$index_name.'"'.self::whereClause($table, TRUE),
'',
'',
''
@ -1219,13 +1219,12 @@ class tx_dlf_helper {
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
// Now we use the uid of the l18_parent to fetch the index_name of the translated content element.
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'index_name',
$table,
'pid='.$pid.' AND l18n_parent='.$resArray['uid'].' AND sys_language_uid='.intval($GLOBALS['TSFE']->sys_language_content).self::whereClause($table),
'pid='.$pid.' AND l18n_parent='.$resArray['uid'].' AND sys_language_uid='.intval($GLOBALS['TSFE']->sys_language_content).self::whereClause($table, TRUE),
'',
'',
''
@ -1234,11 +1233,12 @@ class tx_dlf_helper {
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
// If there is an translated content element, overwrite the received $index_name.
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
$index_name = $resArray['index_name'];
}
}
// Check if we already got a translation.
@ -1259,7 +1259,7 @@ class tx_dlf_helper {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
$table,
'pid='.$pid.$additionalWhere.self::whereClause($table),
'pid='.$pid.$additionalWhere.self::whereClause($table, TRUE),
'',
'',
''

View File

@ -249,6 +249,24 @@ class tx_dlf_metadata extends tx_dlf_plugin {
}
// Get list of collections to show.
$collList = array ();
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_collections.index_name AS index_name',
'tx_dlf_collections',
'tx_dlf_collections.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_collections'),
'',
'',
''
);
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$collList[] = $resArray['index_name'];
}
// Save original data array.
$cObjData = $this->cObj->data;
@ -328,8 +346,17 @@ class tx_dlf_metadata extends tx_dlf_plugin {
} elseif ($index_name == 'collection' && !empty($value)) {
// Translate collection.
$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages']));
// Check if collections isn't hidden.
if (in_array($value, $collList)) {
// Translate collection.
$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages']));
} else {
$value = '';
}
} elseif ($index_name == 'language' && !empty($value)) {