【问题标题】:SilverStripe admin area overwriteSilverStripe 管理区域覆盖
【发布时间】:2013-12-03 10:40:06
【问题描述】:

在 SilverStripe 3.1 中是否可以覆盖 SilverStripe 徽标和显示在左侧 CMS 顶部的 url(而不是替换它)?

【问题讨论】:

    标签: silverstripe


    【解决方案1】:

    我发现,对于 silverstripe 4.2,命名空间是不够的 - 目录也需要公开,即。在~/resources/mysite/css/ 提供,所以我只是将它移到我的主题中。

    【讨论】:

      【解决方案2】:

      对于 SilverStripe 4,它必须带有命名空间:

      SilverStripe\Admin\LeftAndMain:
        extra_requirements_css:
          - mysite/css/leftandmainextracss.css
      

      【讨论】:

        【解决方案3】:

        在 SilverStripe 3.1 中,我们可以使用一些自定义 css 覆盖徽标。

        首先,我们告诉LeftAndMain 包含一个额外的css 文件,方法是将其添加到我们的config.yml

        LeftAndMain:
          extra_requirements_css:
            - mysite/css/leftandmainextracss.css
        

        然后在我们的leftandmainextracss.css 文件中,我们可以编辑默认徽标 css 以加载我们想要的任何图像:

        .cms-logo a {
            background: url("../images/new-branding-cms-logo.png") no-repeat left center;
        }
        

        我们可以在config.yml中设置url和title:

        LeftAndMain:
          application_link: 'http://www.example.com'
          application_name: 'Example'
          extra_requirements_css:
            - mysite/css/leftandmainextracss.css
        

        这里有一些关于扩展cms接口的细节:https://docs.silverstripe.org/en/3.1/developer_guides/customising_the_admin_interface/how_tos/extend_cms_interface/

        还有这个模块可以更改 CMS 品牌。我没有测试过这个:https://github.com/skorp/Silverstripe--CMSbranding

        【讨论】:

        • css文件名后面的:需要去掉。 mysite/css/leftandmainextracss.css
        • 你是对的@GavinBruce。感谢您指出该错误。我现在已经解决了。
        • 只是为了补充这一点,您还可以设置application_link。他也确实问过这个问题。
        • 谢谢@drye 我错过了这个问题。我已经按照您的建议添加了有关如何更改 application_linkapplication_name 的详细信息。
        【解决方案4】:

        我发现我必须对上述解决方案进行一项更改。在config.yml 中声明extra_requirements_css 时,我必须这样做:

        LeftAndMain:
          extra_requirements_css: [mysite/css/leftandmainextracss.css]
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2016-03-12
          • 1970-01-01
          • 1970-01-01
          • 2021-01-26
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多