-
-
Notifications
You must be signed in to change notification settings - Fork 549
/
HtmlColumnBlock.cs
51 lines (45 loc) · 1.28 KB
/
HtmlColumnBlock.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
/*
* Copyright (c) .NET Foundation and Contributors
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*
* https://github.com/piranhacms/piranha.core
*
*/
using System.Text;
using Piranha.Extend.Fields;
namespace Piranha.Extend.Blocks;
/// <summary>
/// Two column HTML block.
/// </summary>
[BlockType(Name = "Two Cols", Category = "Content", Icon = "fab fa-html5", Component = "html-column-block", IsUnlisted = true)]
public class HtmlColumnBlock : Block, ISearchable
{
/// <summary>
/// Gets/sets the first column.
/// </summary>
public HtmlField Column1 { get; set; }
/// <summary>
/// Gets/sets the second column.
/// </summary>
public HtmlField Column2 { get; set; }
/// <summary>
/// Gets the content that should be indexed for searching.
/// </summary>
public string GetIndexedContent()
{
var content = new StringBuilder();
// Add first column
if (!string.IsNullOrEmpty(Column1.Value))
{
content.AppendLine(Column1.Value);
}
// Add second column
if (!string.IsNullOrEmpty(Column2.Value))
{
content.AppendLine(Column2.Value);
}
return content.ToString();
}
}