Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @using Sitecore.XA.Foundation.MarkupDecorator.Extensions
- @using Sitecore.XA.Foundation.SitecoreExtensions.Extensions
- @model myworkspace.Models.SectionTitle
- <div @Html.Sxa().Component("section-title", Model.Attributes)>
- <div class="component-content text-green section-title">
- @Html.Sxa().Field("Title", Model.Item, Model.GetRenderingWebEditingParams())
- <span class="underline-shape-line"></span>
- <span class="underline-shape-disc"></span>
- </div>
- public class SectionTitle : RenderingModelBase
- {
- public SectionTitle() { }
- public string Title { get; set; }
- }
- public class SectionTitleController : StandardController
- {
- private readonly ISectionTitleRepository _repository;
- public SectionTitleController(ISectionTitleRepository repository)
- {
- _repository = repository;
- }
- protected override object GetModel()
- {
- return _repository.GetModel();
- }
- }
- public interface ISectionTitleRepository: IModelRepository
- {
- }
- public class SectionTitleRepository : ModelRepository, ISectionTitleRepository
- {
- public override IRenderingModelBase GetModel()
- {
- SectionTitle model = new SectionTitle();
- FillBaseProperties(model);
- model.Title = GetTitle();
- return base.GetModel();
- }
- private string GetTitle()
- {
- return PageContext.Current[Templates.SectionTitle.Fields.Title];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement