This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Accessing image fields | |
$image = $doc->getImage("product.image"); | |
// Most of the time you will be using the "main" view | |
$url = $image->getView("main")->getUrl(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Accessing image fields | |
Fragment.Image image = doc.getImage("product.image"); | |
// Most of the time you will be using the "main" view | |
String url = image.getView("main").getUrl(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Accessing image fields | |
val image: Option[Fragment.Image] = doc.getImage("product.image") | |
// Most of the time you will be using the "main" view | |
val url: Option[String] = image.map(_.main.url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Accessing image fields | |
var image = doc.getImage("product.image"); | |
// Most of the time you will be using the "main" view | |
var url = image.main.url; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO | |
var cache = LambdaCache.For ( | |
(key, value, ttl) => { | |
return null; | |
}, | |
key => { | |
return null; | |
} | |
); | |
// This Api will use the custom cache object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "near" predicate for GeoPoint fragments | |
var near = "[[:d = geopoint.near(my.store.location, 48.8768767, 2.3338802, 10)]]"; | |
// Accessing GeoPoint fragments | |
fragments.GeoPoint place = document.GetGeoPoint("article.location"); | |
var coordinates = place.Latitude + "," + place.Longitude; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bgcolor = document.GetColor("article.background"); | |
var hex = bgcolor.Hex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var video = document.GetEmbed ("article.video"); | |
// Html is the code to include to embed the object, and depends on the embedded service | |
var html = video.Html; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var resolver = | |
prismic.DocumentLinkResolver.For (l => String.Format ("http://localhost/{0}/{1}", l.Id, l.Slug)); | |
var source = document.GetLink("article.source"); | |
var url = source.GetUrl(resolver); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var group = document.GetGroup("article.documents"); | |
foreach (GroupDoc doc in group.GroupDocs) { | |
try { | |
fragments.StructuredText desc = doc.GetStructuredText("desc"); | |
fragments.Link link = doc.GetLink("linktodoc"); | |
} catch (Exception e) { | |
// Missing key | |
} | |
} |