Open Closed

Change / Override application logo and name for MVC #139


User avatar
0
rajasekhard2015 created

I have added override the logo path it's not effecting in the page

public class AbpIoDocsBrandingProvider : DefaultBrandingProvider
{
    public override string AppName => "Acme - MyBookStore";
    public override string LogoUrl => "/images/myLogo.png";
}

6 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    I've created an internal issue for this. by the way, you can change the logo by overwriting the file in your wwwroot/images/logo/ folder

    src\Acme.BookStore.Web\wwwroot\images\logo\theme1.png
    src\Acme.BookStore.Web\wwwroot\images\logo\theme1-reverse.png
    
  • User Avatar
    0
    rajasekhard2015 created

    Yes i done this way but i need to change the logo tenant based. is any other way to display tenant based logo?

  • User Avatar
    0
    alper created
    Support Team Director

    As of v2.7.0 you can override application logo easily without replacing the physical logo png files. You can inject any service and create your own logic to set the logo.

        [Dependency(ReplaceServices = true)]
        public class BookStoreBrandingProvider : DefaultBrandingProvider
        {
            //You can inject services here...
            private readonly ICurrentTenant _currentTenant;
    
            public BookStoreBrandingProvider(ICurrentTenant currentTenant)
            {
                _currentTenant = currentTenant;
            }
    
            public override string AppName => "Acme - MyBookStore";
    
            public override string LogoUrl
            {
                get
                {
                    if (_currentTenant.Name == "MyCustomer")
                    {
                        return "http://mycustomer.com/logo.png";
                    }
    
                    if (_currentTenant.Id.HasValue)
                    {
                        return $"/images/logo/{_currentTenant.Id}";
                    }
    
                    return "/images/logo/my-default-app-logo.png";
                }
            }
    
            public override string LogoReverseUrl => LogoUrl;
        }
    

  • User Avatar
    0
    arifharsono created

    I create this class at xxx.Application.Contracts, but getting error DefaultBrandingProvider, What iam missing ??, abp version 2.7.0

    using Volo.Abp.DependencyInjection; using Volo.Abp.MultiTenancy; [Dependency(ReplaceServices = true)] public class COREBrandingProvider : DefaultBrandingProvider <== Error { //You can inject services here... private readonly ICurrentTenant _currentTenant;

        public COREBrandingProvider(ICurrentTenant currentTenant)
        {
            _currentTenant = currentTenant;
        }
    
        public override string AppName =&gt; "Acme - MyBookStore";
    
        public override string LogoUrl
        {
    
  • User Avatar
    0
    saintpoida created

    @arifharsono I believe you have to create it in the Host/Web/Identity projects (depending on what setup your using) to get access to DefaultBrandingProvider

    Its located in Volo.Abp.AspNetCore.Mvc.UI.Theme.SharedComponents

  • User Avatar
    0
    alper created
    Support Team Director

    @arifharsono you cannot use this class in Application.Contracts because that layer is not aware of Web components.

    Use it in your *.Web project. There should be already a BookStoreBrandingProvider.cs in your web project. (Change BookStore with your project name)

    The class in this package => Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared

    namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Components
    {
        public class DefaultBrandingProvider : IBrandingProvider, ITransientDependency
        {
            public virtual string AppName => "MyApplication";
    
            public virtual string LogoUrl => null;
    
            public virtual string LogoReverseUrl => null;
        }
    }
    
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11