-
Notifications
You must be signed in to change notification settings - Fork 13
/
UmbMaster.cs
53 lines (46 loc) · 1.33 KB
/
UmbMaster.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
namespace Umbraco.Extensions.Models
{
using Our.Umbraco.Vorto.Extensions;
using Umbraco.Core;
using Umbraco.ModelsBuilder;
/// <summary>
/// The umb master.
/// </summary>
public partial class UmbMaster
{
/// <summary>
/// Gets the url segment.
/// </summary>
[ImplementPropertyType("urlSegment")]
public string UrlSegment
{
get
{
var urlSegment = this.GetVortoValue<string>("urlSegment");
if (string.IsNullOrEmpty(urlSegment))
{
urlSegment = this.UrlName;
}
return urlSegment.ToUrlSegment().EnsureEndsWith("/");
}
}
/// <summary>
/// Gets the url segment for a specific culture.
/// </summary>
/// <param name="culture">
/// The culture
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
public string GetUrlSegment(string culture)
{
var urlSegment = this.GetVortoValue<string>("urlSegment", culture);
if (string.IsNullOrEmpty(urlSegment))
{
urlSegment = this.UrlName;
}
return urlSegment.ToUrlSegment().EnsureEndsWith("/");
}
}
}