Skip to content

Instantly share code, notes, and snippets.

@tomasnorre
Created September 4, 2015 16:19
Show Gist options
  • Save tomasnorre/83dc81ed87216157d026 to your computer and use it in GitHub Desktop.
Save tomasnorre/83dc81ed87216157d026 to your computer and use it in GitHub Desktop.
Index: hooks/class.tx_languagevisibility_hooks_t3lib_page.php
===================================================================
--- hooks/class.tx_languagevisibility_hooks_t3lib_page.php (revision 48229)
+++ hooks/class.tx_languagevisibility_hooks_t3lib_page.php (working copy)
@@ -74,6 +74,8 @@
* @return void
*/
public function getRecordOverlay_preProcess($table, &$row, &$sys_language_content, $OLmode, t3lib_pageSelect $parent) {
+ global $TCA;
+
if (! is_array($row) || ! isset($row['uid'])) {
return;
}
@@ -86,8 +88,12 @@
}
if ($overlayLanguage === false) {
- $row['uid'] = 0;
- $row['pid'] = 0;
+ if ($OLmode === 'hideNonTranslated' && $row[$TCA[$table]['ctrl']['languageField']] == 0) {
+ $row = false;
+ } else {
+ $row['uid'] = 0;
+ $row['pid'] = 0;
+ }
return;
/*} else if ($overlayLanguage === 0) {
//TODO - what happens here?
@@ -98,7 +104,7 @@
/**
* the original value will be replaced by the original getRecordOverlay process
- * therefore we've to store this elsewhere to make sure that the flexdata is available
+ * therefore we've to store this elsewhere to make sure that the flexdata is available
* for the postProcess
**/
if ($element instanceof tx_languagevisibility_fceoverlayelement) {
Index: hooks/class.tx_languagevisibility_hooks_t3lib_page.php
===================================================================
--- hooks/class.tx_languagevisibility_hooks_t3lib_page.php (revision 70289)
+++ hooks/class.tx_languagevisibility_hooks_t3lib_page.php (working copy)
@@ -129,6 +129,10 @@
* @return void
*/
public function getRecordOverlay_postProcess($table, &$row, &$sys_language_content, $OLmode, t3lib_pageSelect $parent) {
+ if ($row['uid'] == 0 && $row['pid'] == 0) {
+ $row = NULL;
+ }
+
if (! is_array($row) || ! isset($row['uid']) || $sys_language_content == 0) {
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment