private string GetFieldValue(HeaderField headerField, PublishingFunctionProcessor.FieldType fieldType = PublishingFunctionProcessor.FieldType.String) { // check if the target field name contains a delimiter value if (headerField.Name.Contains(";")) { // extract the array of field names to process, and trims each one string[] targetFieldNames = headerField.Name.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToArray(); // sets the field name to the first "valid" entry headerField.Name = this.publishingPageTransformationInformation.GetFirstNonEmptyFieldName(targetFieldNames); } string fieldValue = null; if (!string.IsNullOrEmpty(headerField.Functions)) { // execute function var evaluatedField = this.functionProcessor.Process(headerField.Functions, headerField.Name, fieldType); if (!string.IsNullOrEmpty(evaluatedField.Item1)) { fieldValue = evaluatedField.Item2; } } else { fieldValue = this.publishingPageTransformationInformation.SourcePage.FieldValues[headerField.Name]?.ToString().Trim(); } return(fieldValue); }
private string GetFieldValue(HeaderField headerField, PublishingFunctionProcessor.FieldType fieldType = PublishingFunctionProcessor.FieldType.String) { string fieldValue = null; if (!string.IsNullOrEmpty(headerField.Functions)) { // execute function var evaluatedField = this.functionProcessor.Process(headerField.Functions, headerField.Name, fieldType); if (!string.IsNullOrEmpty(evaluatedField.Item1)) { fieldValue = evaluatedField.Item2; } } else { fieldValue = this.publishingPageTransformationInformation.SourcePage.FieldValues[headerField.Name]?.ToString().Trim(); } return(fieldValue); }