0

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.

Community
  • 1
  • 1
Mark Handy
  • 1,180
  • 1
  • 11
  • 23

1 Answers1

2

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.

Brenden Kehren
  • 5,919
  • 16
  • 27
  • It fails if there is code in the HTML Envelope. I remove the HTML i have there, and it's good. – Mark Handy Jun 16 '16 at 13:55
  • Ok, i created a new layout, wrapped the CMS tag in the HTML i needed, and used your code example as is. I did not change .editabletext to match my Web part control ID. It's working. – Mark Handy Jun 16 '16 at 14:05
  • 1
    Slight correction. I was cached, so '.editabletext' was changed. Cheers! – Mark Handy Jun 17 '16 at 12:34