public InformationTile GetInformationTile(IPublishedContent tileContentItem) { var informationTile = new InformationTile(); if (tileContentItem == null) { return(informationTile); } informationTile.Image = _mediaModelService .GetMediaModel(tileContentItem.GetPropertyValue <IPublishedContent>(PropertyAliases.InformationTile.Image)); if (!informationTile.IsImageTile) { informationTile.Title = tileContentItem.GetPropertyValue <string>(PropertyAliases.InformationTile.Title); informationTile.Copy = tileContentItem.GetPropertyValue <string>(PropertyAliases.InformationTile.Copy); informationTile.Icon = _mediaModelService .GetMediaModel(tileContentItem.GetPropertyValue <IPublishedContent>(PropertyAliases.InformationTile.Icon)); } return(informationTile); }
public ImageLink GetImageLink(IPublishedContent imageLinkContentItem) { var imageLink = new ImageLink(); if (imageLinkContentItem == null) { return(imageLink); } imageLink.Image = _mediaModelService .GetMediaModel(imageLinkContentItem .GetPropertyValue <IPublishedContent>(PropertyAliases.ImageLink.Image)); var multiUrls = imageLinkContentItem.GetPropertyValue <MultiUrls>(PropertyAliases.ImageLink.Link); if (!multiUrls.IsNullOrEmpty()) { imageLink.Link = multiUrls.FirstOrDefault(); } return(imageLink); }
private IEnumerable <ContactDetailBlock> GetContactDetailBlocks(IEnumerable <IPublishedContent> contactDetailsBlocksContent) { var contactDetailBlocks = new List <ContactDetailBlock>(); if (contactDetailsBlocksContent.IsNullOrEmpty()) { return(contactDetailBlocks); } foreach (var contactDetailBlocksContentItem in contactDetailsBlocksContent) { contactDetailBlocks.Add(new ContactDetailBlock { Icon = _mediaModelService .GetMediaModel(contactDetailBlocksContentItem .GetPropertyValue <IPublishedContent>(PropertyAliases.ContactDetailBlock.Icon)), Title = contactDetailBlocksContentItem.GetPropertyValue <string>(PropertyAliases.ContactDetailBlock.Title), Copy = contactDetailBlocksContentItem.GetPropertyValue <IHtmlString>(PropertyAliases.ContactDetailBlock.Copy) }); } return(contactDetailBlocks); }
public BannerViewModel GetViewModel(IPublishedContent componentContent) { var viewModel = new BannerViewModel { BackgroundImage = new MediaModel(), BannerSlides = new List <BannerSlide>() }; if (componentContent == null) { return(viewModel); } PopulateComponentBaseProperties(viewModel, componentContent); var headerContent = componentContent .GetPropertyValue <IEnumerable <IPublishedContent> >(PropertyAliases.Banner.Header); if (!headerContent.IsNullOrEmpty()) { viewModel.HeaderViewModel = _headerService.GetViewModel(headerContent.First()); } viewModel.BackgroundImage = _mediaModelService .GetMediaModel(componentContent.GetPropertyValue <IPublishedContent>(PropertyAliases.Banner.BackgroundImage)); var bannerSlidesContent = componentContent .GetPropertyValue <IEnumerable <IPublishedContent> >(PropertyAliases.Banner.BannerSlides); if (bannerSlidesContent != null) { viewModel.BannerSlides = GetBannerSlides(bannerSlidesContent); } return(viewModel); }