Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @using umbraco.MacroEngines;
- @using System.Xml;
- @functions {
- public static string GetMediaCropperUrl(object crops, string cropName)
- {
- string cropUrl = string.Empty;
- if (crops.GetType() == typeof(DynamicXml))
- {
- DynamicXml cropsXml = (DynamicXml)crops;
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.LoadXml(cropsXml.BaseElement.ToString());
- XmlNode cropNode = xmlDocument.SelectSingleNode("descendant::crops/crop[@name='" + cropName + "']");
- if (cropNode != null)
- {
- cropUrl = cropNode.Attributes.GetNamedItem("url").InnerText;
- }
- }
- return cropUrl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment