2021-02-18 11:06:02 +01:00
|
|
|
|
namespace Umbraco.Cms.Core.Models.PublishedContent
|
2018-04-18 19:46:47 +02:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2018-04-30 21:29:49 +02:00
|
|
|
|
/// Represents the variation context.
|
2018-04-18 19:46:47 +02:00
|
|
|
|
/// </summary>
|
2018-04-30 21:29:49 +02:00
|
|
|
|
public class VariationContext
|
2018-04-18 19:46:47 +02:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2018-04-30 21:29:49 +02:00
|
|
|
|
/// Initializes a new instance of the <see cref="VariationContext"/> class.
|
2018-04-18 19:46:47 +02:00
|
|
|
|
/// </summary>
|
2018-04-30 21:29:49 +02:00
|
|
|
|
public VariationContext(string culture = null, string segment = null)
|
2018-04-18 19:46:47 +02:00
|
|
|
|
{
|
2018-04-30 21:03:43 +02:00
|
|
|
|
Culture = culture ?? ""; // cannot be null, default to invariant
|
|
|
|
|
|
Segment = segment ?? ""; // cannot be null, default to neutral
|
2018-04-18 19:46:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the culture.
|
|
|
|
|
|
/// </summary>
|
2018-04-30 21:03:43 +02:00
|
|
|
|
public string Culture { get; }
|
2018-04-18 19:46:47 +02:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the segment.
|
|
|
|
|
|
/// </summary>
|
2018-04-30 21:03:43 +02:00
|
|
|
|
public string Segment { get; }
|
2020-03-09 17:07:56 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the segment for the content item
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="contentId"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public virtual string GetSegment(int contentId) => Segment;
|
2018-04-18 19:46:47 +02:00
|
|
|
|
}
|
2018-04-29 20:02:38 +02:00
|
|
|
|
}
|