Webiant Logo Webiant Logo
  1. No results found.

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

_ConfigurePlugin.cshtml

@using Microsoft.AspNetCore.Mvc.Controllers
@using Nop.Services.Authentication.External
@using Nop.Services.Authentication.MultiFactor
@using Nop.Services.Catalog
@using Nop.Services.Cms
@using Nop.Services.Payments
@using Nop.Services.Plugins
@using Nop.Services.Shipping
@using Nop.Services.Shipping.Pickup
@using Nop.Services.Tax
@inject IPluginService pluginService
@inject IWebHelper webHelper
@{
    var plugin = pluginService.FindPluginByTypeInAssembly((this.ViewContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo);

    //friendly name
    var friendlyName = plugin?.PluginDescriptor.FriendlyName;

    var activeMenuSystemName = string.Empty;
    var configureLocale = string.Empty;
    var backToLocale = string.Empty;
    var listActionMethodName = string.Empty;
    var listControllerName = string.Empty;

    if (plugin is IPaymentMethod)
    {
        //payment plugin
        activeMenuSystemName = "Payment methods";
        configureLocale = "Admin.Configuration.Payment.Methods.Configure";
        backToLocale = "Admin.Configuration.Payment.Methods.BackToList";
        listActionMethodName = "PaymentMethods";
        listControllerName = "Payment";
    }
    else if (plugin is IShippingRateComputationMethod)
    {
        //shipping rate computation method
        activeMenuSystemName = "Shipping providers";
        configureLocale = "Admin.Configuration.Shipping.Providers.Configure";
        backToLocale = "Admin.Configuration.Shipping.Providers.BackToList";
        listActionMethodName = "Providers";
        listControllerName = "Shipping";
    }
    else if (plugin is IPickupPointProvider)
    {
        //pickup point provider
        activeMenuSystemName = "Pickup points";
        configureLocale = "Admin.Configuration.Shipping.PickupPointProviders.Configure";
        backToLocale = "Admin.Configuration.Shipping.PickupPointProviders.BackToList";
        listActionMethodName = "PickupPointProviders";
        listControllerName = "Shipping";
    }
    else if (plugin is ITaxProvider)
    {
        //tax provider
        activeMenuSystemName = "Tax providers";
        configureLocale = "Admin.Configuration.Tax.Providers.Configure";
        backToLocale = "Admin.Configuration.Tax.Providers.BackToList";
        listActionMethodName = "List";
        listControllerName = "Tax";
    }
    else if (plugin is IExternalAuthenticationMethod)
    {
        //external auth method
        activeMenuSystemName = "External authentication methods";
        configureLocale = "Admin.Configuration.Authentication.ExternalMethods.Configure";
        backToLocale = "Admin.Configuration.Authentication.ExternalMethods.BackToList";
        listActionMethodName = "ExternalMethods";
        listControllerName = "Authentication";
    }
    else if (plugin is IMultiFactorAuthenticationMethod)
    {
        //multi-factor authentication method
        activeMenuSystemName = "Multi-factor authentication methods";
        configureLocale = "Admin.Configuration.Authentication.MultiFactorMethods.Configure";
        backToLocale = "Admin.Configuration.Authentication.MultiFactorMethods.BackToList";
        listActionMethodName = "MultiFactorMethods";
        listControllerName = "Authentication";

    }
    else if (plugin is IWidgetPlugin widget && !widget.HideInWidgetList)
    {
        //widgets
        activeMenuSystemName = "Widgets";
        configureLocale = "Admin.ContentManagement.Widgets.Configure";
        backToLocale = "Admin.ContentManagement.Widgets.BackToList";
        listActionMethodName = "List";
        listControllerName = "Widget";
    }
    else if (plugin is IMiscPlugin)
    {
        //Misc plugins
        activeMenuSystemName = "Local plugins";
        configureLocale = "Admin.Configuration.Plugins.Misc.Configure";
        backToLocale = "Admin.Configuration.Plugins.Misc.BackToList";
        listActionMethodName = "List";
        listControllerName = "Plugin";
    }
    else if (plugin is ISearchProvider)
    {
        //search provider
        activeMenuSystemName = "Local plugins";
        configureLocale = "Admin.Configuration.Plugins.SearchProvider.Configure";
        backToLocale = "Admin.Configuration.Plugins.SearchProvider.BackToList";
        listActionMethodName = "List";
        listControllerName = "Plugin";
    }

    //IAdminMenuPlugin can set own active menu item
    if (plugin is IAdminMenuPlugin && NopHtml.GetActiveMenuItemSystemName() is string menuItem && !string.IsNullOrEmpty(menuItem))
        activeMenuSystemName = menuItem;

    Layout = "_AdminLayout";
    //page title
    ViewBag.PageTitle = T(configureLocale).Text + " - " + friendlyName;
    //active menu item (system name)
    NopHtml.SetActiveMenuItemSystemName(activeMenuSystemName);

}

@T(configureLocale) - @friendlyName @T(backToLocale)

 
@RenderBody()