3

I want to hide a language from my language menu if a news record is not translated.

The following setup works perfectly for pages. So if a page has no translation, the "English" is not shown in the language menu on the website.

I would like to have this behaviour for not translated news records as well.

The language menu so far:

lib.language = COA
lib.language {
    20 = HMENU
    20 {
        special = language
        special.value = 0,1
        special.normalWhenNoLanguage = 0
        wrap =
        1 = TMENU
        1 {
            noBlur = 1
            NO = 1
            NO {
                linkWrap = <li>|</li>
                stdWrap.override = Deutsch || English
                stdWrap {
                    typolink {
                        parameter.data = page:uid
                        additionalParams = &L=0 || &L=1 
                        ATagParams = hreflang="de-DE" || hreflang="en-GB"
                        addQueryString = 1
                        addQueryString.exclude = L,id,cHash,no_cache
                        addQueryString.method = GET
                        useCacheHash = 1
                        no_cache = 0
                    }
                }
            }

            ACT < .NO
            ACT.linkWrap = <li class="active">|</li>
            USERDEF1 = 1
            USERDEF1 {
                ldoNotLinkIt = 1
                stdWrap.cObject = TEXT
                stdWrap.cObject.value = 
            }

            USERDEF2 = 1
            USERDEF2 {
                doNotLinkIt = 1
                stdWrap.cObject = TEXT
                stdWrap.cObject.value = 
            }
        }
    }

    wrap = <ul id="language_menu" class="language-menu">|</ul>
}

My typoscript configuration:

  config.sys_language_mode = strict
  config.sys_language_overlay = hideNonTranslated

LocalConfiguration.php

[FE][hidePagesIfNotTranslatedByDefault] = 1
chris
  • 2,109
  • 2
  • 23
  • 33

1 Answers1

0

You have to manually set the USERDEF1 state. This Utility class should help: https://gist.github.com/birger-fuehne/a8a97c94ec9346d691174462ccbfcfcc

Markus Bischof
  • 169
  • 1
  • 11