Where did CMS.CMSHelper.CMSContext go?

Cesar Pinilla asked on April 14, 2014 17:42

I’m upgrading an existing kentico webapp to version 8 but I’m unsure where the CMS.CMSHelper.CMSContext library is now? I can’t seem to find any documentation on how to update existing code that relied on those libraries to work.

For example, I’ve used calls like this in the past to set up different page elements dynamically:

  • CMSContext.CurrentDocument.DocumentName
  • CMSContext.CurrentAliasPath
  • CMSContext.ViewMode == CMS.PortalEngine.ViewModeEnum.Edit (to test if in editor mode or preview or live)
  • CMSContext.CurrentPageInfo.EditableItems[“test”]

Anyone have any ideas? Thanks

Correct Answer

Vilém Jeniš answered on April 15, 2014 01:24

Hi Cesar,

CMSContext was broken up into sevral classes. The members you are looking for are now:

  • DocumentContext.CurrentDocument.DocumentName
  • DocumentContext.CurrentAliasPath
  • PortalContext.ViewMode
  • DocumentContext.CurrentPageInfo.EditableItems

and

  • DocumentContext is now in DocumentEngine.dll in CMS.DocumentEngine namespace
  • PortalContext is in PortalEngine.dll in CMS.PortalEngine namespace

Hope this helps!

5 votesVote for this answer Unmark Correct answer

Recent Answers


Cesar Pinilla answered on April 15, 2014 12:29

Thanks so much Vilém!

0 votesVote for this answer Mark as a Correct answer

Peter Falcon answered on April 16, 2014 19:15

Thanks for the above, where am I able to find the CMSContext.GetUrl method and is there somewhere that references the Kentico 7 -> 8 api refactoring?

0 votesVote for this answer Mark as a Correct answer

Petros Giallelis answered on May 13, 2014 09:35

Peter, the GetUrl method is here CMS.DocumentEngine.DocumentURLProvider.GetUrl. I found the API CHM to be useful for changes like these.

0 votesVote for this answer Mark as a Correct answer

Rananjay Singh answered on September 10, 2014 08:25

I have find CMS.CMSHelper.CMSConetxt methode in CMS.DocumentEngine; Here i have find "node alias path" DocumentContext.CurrentDocument.NodeAliasPath.Contains("NodeAliasTextHere");

0 votesVote for this answer Mark as a Correct answer

Vilém Jeniš answered on December 4, 2014 15:27

If you need to find where did parts of our API go, you can find it here https://devnet.kentico.com/documentation/api-changes/kentico-8?page=1

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.