Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

ViewLocationExpander.cs

using Microsoft.AspNetCore.Mvc.Razor;

namespace Nop.Plugin.Misc.Omnisend.Infrastructure;

/// 
/// Specifies the contracts for a view location expander that is used by Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine instances to determine search paths for a view.
/// 
public class ViewLocationExpander : IViewLocationExpander
{
    /// 
    /// Invoked by a  to determine the values that would be consumed by this instance
    /// of . The calculated values are used to determine if the view location
    /// has changed since the last time it was located.
    /// 
    /// The  for the current view location
    /// expansion operation.
    public void PopulateValues(ViewLocationExpanderContext context)
    {
    }

    /// 
    /// Invoked by a  to determine potential locations for a view.
    /// 
    /// The  for the current view location
    /// expansion operation.
    /// The sequence of view locations to expand.
    /// A list of expanded view locations.
    public IEnumerable ExpandViewLocations(ViewLocationExpanderContext context,
        IEnumerable viewLocations)
    {
        viewLocations = new[] { $"/Plugins/Misc.Omnisend/Views/{context.ViewName}.cshtml" }
            .Concat(viewLocations);

        return viewLocations;
    }
}