Search code examples
kentico

Kentico webpart visibility


i'm trying to hide an editable text webpart if it's empty. Tried some JS methods which aren't elegent (the webpart has a bottom border, so there is a flicker). I then came across this post: Kentico 7 hide editable text if it's empty

Any reason why this won't work in Kentico 9? It's hiding my webpart regardless.


Solution

  • In v8 and > you want to use the below syntax as the CMSContext.CurrentDocument has been deprecated.

    {% (ViewMode != "LiveSite") || (CurrentDocument.editabletext != "") %}
    

    Where you see .editabletext this is the code name of your editable text webpart.