【问题标题】:Drupal 8 How do you wrap blocks in their own HTML without exposing the HTML in the editorDrupal 8 如何在不暴露编辑器中的 HTML 的情况下将块包装在自己的 HTML 中
【发布时间】:2017-11-02 09:57:47
【问题描述】:

我有一个创建页脚区域的网站。这将由两个块组成,一个与页脚的左侧对齐,另一个与右侧对齐。我正在使用 Bootstrap,因此每个块都包含在必要的 HTML 中来描述两列。

我的问题是,我怎样才能将特定的块包装在他们自己的 HTML 中而不在 Drupal 的块编辑器中公开它(以避免用户删除 HTML)。

这是我的 HTML 示例;

<!-- Start: Footer -->
<footer>
    <div class="container">
        <!-- {{ content }} would be inserted here -->

        <!-- Start: Footer menu -->
        <div class="col-xs-12 col-sm-8">
            <img src="/images/logo.png" class="logo">
            <ul class="links">
                <li><a href="#">FAQS</a></li>
                <li><a href="#">RESOURCES</a></li>
                <li><a href="#">RETURN TO MAIN SITE</a></li>
            </ul>
        </div>
        <!-- End: Footer menu -->
        <!-- Start: Social media links block -->
        <div class="col-xs-12 col-sm-4">
            <p>Connect with us:</p>
            <ul class="social">
                <li><a href="#"><span class="fa fa-twitter"></span></a></li>
                <li><a href="#"><span class="fa fa-facebook"></span></a></li>
                <li><a href="#"><span class="fa fa-linkedin"></span></a></li>
                <li><a href="#"><span class="fa fa-google-plus"></span></a></li>
            </ul>
        </div>
        <!-- End: Social media block -->
    </div>
</footer>
<!-- End: Footer -->

【问题讨论】:

    标签: drupal drupal-8


    【解决方案1】:

    如果您在 development.services.yml 中激活 twig 调试,您可以准确地看到每个块的模板名称。 因此,您可以覆盖一个(或多个)特定块的模板并在那里添加包装器

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-21
      • 2010-09-14
      • 1970-01-01
      • 2011-06-20
      • 2019-07-13
      • 1970-01-01
      • 2018-07-14
      相关资源
      最近更新 更多