IWebsiteChannelContext Properties Observation
For the three properties returned in the injected IWebsiteChannelContext interface, the WebsiteChannelName property returns the "Code name" instead of the "Channel Name". The naming convention of the property suggests that Channel name should be the resulting value instead of Code name.
Can a fourth property be added for CodeName to distinguish between the Channel managements's application? I could then inject the IWebsiteChannelContext into the layout using the Channel's name in a layout's footer to ensure the things like a copywrite notice are specific to a channel.
© 2024 Channel Name © 2024 CodeName
Environment
- Xperience by Kentico version: [29.6.0]
- .NET version: [8]
- Deployment environment: [VM]
- Link to relevant Xperience by Kentico documentation
Answers
There is a separation between channel-type independent channel information - ChannelInfo
- and channel-type specific channel information - WebsiteChannelInfo
, HeadlessChannelInfo
, and EmailChannelInfo
.
The channel-type specific objects do not have a "code name" since they are extensions of the channel-type independent ChannelInfo
, which does have a code name - ChannelInfo.ChannelName
.
This ChannelInfo.ChannelName
is what is exposed by IWebsiteChannelContext.WebsiteChannelName
.
The naming convention of the property suggests that Channel name should be the resulting value instead of Code name.
If you look at the SQL table CMS_WebsiteChannel
you can see all of its columns follow the naming convention WebsiteChannel*
including the link back to the CMS_Channel
table WebsiteChannelChannelID
. I suppose IWebsiteChannelContext.WebsiteChannelName
could have been named IWebsiteChannelContext.WebsiteChannelChannelName
but IWebsiteChannelContext
is not a WebsiteChannelInfo
. Instead it's just a convenient way to access the current context information for a specific purpose.
The purpose of IWebsiteChannelContext
is for querying with ContentItemQueryBuilder
where methods like .ForWebsite()
accept a ChannelInfo.ChannelName
value.
Can a fourth property be added for CodeName to distinguish between the Channel managements's application?
What would that fourth property be? There is no other "Code name" value for channels.
To answer this question, you have to login first.