/// <summary> /// Constructor to create a BaseBinaryPathProvider /// </summary> /// <param name="engine">The SDL Web publish engine</param> /// <param name="package">The SDL Web publish package</param> public BaseBinaryPathProvider(Engine engine, Package package) { Engine = engine; Package = package; String targetStructureGroupParam = package.GetValue("sg_PublishBinariesTargetStructureGroup"); if (targetStructureGroupParam != null) { if (!TcmUri.IsValid(targetStructureGroupParam)) { log.Error(String.Format("TargetStructureGroup '{0}' is not a valid TCMURI. Exiting template.", targetStructureGroupParam)); return; } Publication publication = TridionUtils.GetPublicationFromContext(package, engine); TcmUri localTargetStructureGroupTcmUri = TridionUtils.GetLocalUri(new TcmUri(publication.Id), new TcmUri(targetStructureGroupParam)); targetStructureGroupUri = new TcmUri(localTargetStructureGroupTcmUri); log.Debug($"targetStructureGroupUri = {targetStructureGroupUri.ToString()}"); } String stripTcmUrisFromBinaryUrlsParam = package.GetValue("stripTcmUrisFromBinaryUrls"); if (stripTcmUrisFromBinaryUrlsParam != null) { stripTcmUrisFromBinaryUrls = stripTcmUrisFromBinaryUrlsParam.ToLower() == "yes" || stripTcmUrisFromBinaryUrlsParam.ToLower() == "true"; } log.Debug($"stripTcmUrisFromBinaryUrls = {stripTcmUrisFromBinaryUrls}"); }
public BinaryPublisher(Package package, Engine engine) { this.package = package; this.engine = engine; currentTemplate = engine.PublishingContext.ResolvedItem.Template; // Determine (optional) structure group parameter String targetStructureGroupParam = package.GetValue("PublishBinariesTargetStructureGroup"); if (targetStructureGroupParam != null) { if (!TcmUri.IsValid(targetStructureGroupParam)) { log.Error(String.Format("TargetStructureGroup '{0}' is not a valid TCMURI. Exiting template.", targetStructureGroupParam)); return; } Publication publication = TridionUtils.GetPublicationFromContext(package, engine); TcmUri localTargetStructureGroupTcmUri = TridionUtils.GetLocalUri(new TcmUri(publication.Id), new TcmUri(targetStructureGroupParam)); targetStructureGroup = new TcmUri(localTargetStructureGroupTcmUri); } }