Drupal 8,如何为自定义块禁用drupal-ajax?

时间:2018-06-07 17:01:09

标签: drupal-8 drupal-ajax

我使用Drupal 8,并在管理面板中创建了自定义块。 它在匿名用户下工作正常。块看起来像:

<div class='custom_block'>...</div>

但在任何经过​​身份验证的用户下,Drupal使用vnd.drupal-ajax加载我的块:

<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder&amp;args%5B0%5D=views_block__random_comics_block_1&amp;args%5B1%5D=full&amp;args%5B2%5D&amp;token=JNTrJqMmnZdh--f87NgpOGMFO3WNhdjK0yN13IlQwgI">
[{"command":"insert","method":"replaceWith","selector":"[data-big-pipe-placeholder-id=\u0022callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder\u0026args%5B0%5D=views_block__random_comics_block_1\u0026args%5B1%5D=full\u0026args%5B2%5D\u0026token=JNTrJqMmnZdh--f87NgpOGMFO3WNhdjK0yN13IlQwgI\u0022]","data":"\u003Cdiv class=\u0022views-element-container block block-views block-views-blockrandom-comics-block-1 col-12 col-sm-6 col-md-4\u0022 id=\u0022block-views-block-random-comics-block-1\u0022\u003E\n      \u003Cdiv\u003E\u003Cdiv class=\u0022view view-random-comics view-id-random_comics view-display-id-block_1 js-view-dom-id-81d767a9f4cce7577c81258f8ff196fea144dd4d566e378e5a033da4455d7cf8\u0022\u003E\n  \n    \n      \n      \u003Cdiv class=\u0022view-content\u0022\u003E\n          \u003Cdiv class=\u0022rowrowrow views-row\u0022\u003E\n    \u003Ca href=\u0022\/drupal\/touma-hair-salon\u0022 hreflang=\u0022en\u0022\u003ETouma Hair Salon\u003C\/a\u003E  \u003Ca href=\u0022\/drupal\/touma-hair-salon\u0022\u003E\u003Cimg src=\u0022\/drupal\/sites\/default\/files\/comicss\/Touma%20Hair%20Salon\/cover.png\u0022 width=\u0022150\u0022 height=\u0022212\u0022 alt=\u0022Touma Hair Salon\u0022 title=\u0022Touma Hair Salon\u0022 typeof=\u0022foaf:Image\u0022 \/\u003E\n\u003C\/a\u003E\n\n  \u003C\/div\u003E\n\n    \u003C\/div\u003E\n  \n          \u003C\/div\u003E\n\u003C\/div\u003E\n\n      s\n\u003C\/div\u003E\n","settings":null}]
</script>    <script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder&amp;args%5B0%5D=views_block__content_recent_block_1_2&amp;args%5B1%5D=full&amp;args%5B2%5D&amp;token=K4N2rxD1sYbTFD1a9Qar-Rcv_YCIx0q7UZnAQ-YU0cU">
[{"command":"insert","method":"replaceWith","selector":"[data-big-pipe-placeholder-id=\u0022callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder\u0026args%5B0%5D=views_block__content_recent_block_1_2\u0026args%5B1%5D=full\u0026args%5B2%5D\u0026token=K4N2rxD1sYbTFD1a9Qar-Rcv_YCIx0q7UZnAQ-YU0cU\u0022]","data":"\u003Cdiv class=\u0022views-element-container block block-views block-views-blockcontent-recent-block-1 col-12 col-sm-6 col-md-4\u0022 id=\u0022block-views-block-content-recent-block-1-2\u0022\u003E\n  \n      \u003Ch2\u003ERecent content\u003C\/h2\u003E\n    \n      \u003Cdiv class=\u0022content\u0022\u003E\n      \u003Cdiv\u003E\u003Cdiv class=\u0022view view-content-recent view-id-content_recent view-display-id-block_1 js-view-dom-id-5c84f791828ff62fb95e7aff89be219dc0c51463c280598b4dbeb0c25a41c195\u0022\u003E\n  \n    \n      \n      \u003Cdiv class=\u0022view-content\u0022\u003E\n      \u003Cdiv class=\u0022item-list\u0022\u003E\n  \n  \u003Cul\u003E\n\n          \u003Cli\u003E\u003Cdiv class=\u0022views-field views-field-title\u0022\u003E\u003Cspan class=\u0022field-content\u0022\u003E\u003Ca href=\u0022\/drupal\/666-project-panero-no-ka\u0022 hreflang=\u0022en\u0022\u003E666 Project - Panero no Ka\u003C\/a\u003E\u003C\/span\u003E\u003C\/div\u003E\u003C\/li\u003E\n          \u003Cli\u003E\u003Cdiv class=\u0022views-field views-field-title\u0022\u003E\u003Cspan class=\u0022field-content\u0022\u003E\u003Ca href=\u0022\/drupal\/aim-planet-namek-english\u0022 hreflang=\u0022en\u0022\u003EAim at Planet Namek - English\u003C\/a\u003E\u003C\/span\u003E\u003C\/div\u003E\u003C\/li\u003E\n          \u003Cli\u003E\u003Cdiv class=\u0022views-field views-field-title\u0022\u003E\u003Cspan class=\u0022field-content\u0022\u003E\u003Ca href=\u0022\/drupal\/akabei-soft-breast-guns-breast-magnum-third\u0022 hreflang=\u0022en\u0022\u003EAkabei Soft - Breast Guns, Breast Magnum Third\u003C\/a\u003E\u003C\/span\u003E\u003C\/div\u003E\u003C\/li\u003E\n          \u003Cli\u003E\u003Cdiv class=\u0022views-field views-field-title\u0022\u003E\u003Cspan class=\u0022field-content\u0022\u003E\u003Ca href=\u0022\/drupal\/alice-no-takarabako-todays-debut-sex-service\u0022 hreflang=\u0022en\u0022\u003EAlice no Takarabako - Today\u0026#039;s the debut of sex service\u003C\/a\u003E\u003C\/span\u003E\u003C\/div\u003E\u003C\/li\u003E\n          \u003Cli\u003E\u003Cdiv class=\u0022views-field views-field-title\u0022\u003E\u003Cspan class=\u0022field-content\u0022\u003E\u003Ca href=\u0022\/drupal\/amix\u0022 hreflang=\u0022en\u0022\u003EAmiX\u003C\/a\u003E\u003C\/span\u003E\u003C\/div\u003E\u003C\/li\u003E\n          \u003Cli\u003E\u003Cdiv class=\u0022views-field views-field-title\u0022\u003E\u003Cspan class=\u0022field-content\u0022\u003E\u003Ca href=\u0022\/drupal\/brother-complex\u0022 hreflang=\u0022en\u0022\u003EBrother Complex\u003C\/a\u003E\u003C\/span\u003E\u003C\/div\u003E\u003C\/li\u003E\n          \u003Cli\u003E\u003Cdiv class=\u0022views-field views-field-title\u0022\u003E\u003Cspan class=\u0022field-content\u0022\u003E\u003Ca href=\u0022\/drupal\/comic-party\u0022 hreflang=\u0022en\u0022\u003EComic Party\u003C\/a\u003E\u003C\/span\u003E\u003C\/div\u003E\u003C\/li\u003E\n          \u003Cli\u003E\u003Cdiv class=\u0022views-field views-field-title\u0022\u003E\u003Cspan class=\u0022field-content\u0022\u003E\u003Ca href=\u0022\/drupal\/crimson-comics-revenge-freedom\u0022 hreflang=\u0022en\u0022\u003ECrimson Comics - Revenge of Freedom\u003C\/a\u003E\u003C\/span\u003E\u003C\/div\u003E\u003C\/li\u003E\n          \u003Cli\u003E\u003Cdiv class=\u0022views-field views-field-title\u0022\u003E\u003Cspan class=\u0022field-content\u0022\u003E\u003Ca href=\u0022\/drupal\/f-four-company-02\u0022 hreflang=\u0022en\u0022\u003EF-Four Company 02\u003C\/a\u003E\u003C\/span\u003E\u003C\/div\u003E\u003C\/li\u003E\n          \u003Cli\u003E\u003Cdiv class=\u0022views-field views-field-title\u0022\u003E\u003Cspan class=\u0022field-content\u0022\u003E\u003Ca href=\u0022\/drupal\/harmony-selection\u0022 hreflang=\u0022en\u0022\u003EHarmony Selection\u003C\/a\u003E\u003C\/span\u003E\u003C\/div\u003E\u003C\/li\u003E\n    \n  \u003C\/ul\u003E\n\n\u003C\/div\u003E\n\n    \u003C\/div\u003E\n  \n          \u003C\/div\u003E\n\u003C\/div\u003E\n\n    \u003C\/div\u003E\n  \u003C\/div\u003E\n","settings":null}]
</script>    <script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder&amp;args%5B0%5D=comicss_local_tasks&amp;args%5B1%5D=full&amp;args%5B2%5D&amp;token=8rqlt5BS0vYDQGBUmxJbvhMVgJiTYK_rWYagNiIIe5s">
[{"command":"insert","method":"replaceWith","selector":"[data-big-pipe-placeholder-id=\u0022callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder\u0026args%5B0%5D=comics_local_tasks\u0026args%5B1%5D=full\u0026args%5B2%5D\u0026token=8rqlt5BS0vYDQGBUmxJbvhMVgJiTYK_rWYagNiIIe5s\u0022]","data":"","settings":null}]
</script>    <script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="callback=Drupal%5CCore%5CRender%5CElement%5CStatusMessages%3A%3ArenderMessages&amp;args%5B0%5D&amp;token=_HAdUpwWmet0TOTe2PSiJuMntExoshbm1kh2wQzzzAA">
[{"command":"insert","method":"replaceWith","selector":"[data-big-pipe-placeholder-id=\u0022callback=Drupal%5CCore%5CRender%5CElement%5CStatusMessages%3A%3ArenderMessages\u0026args%5B0%5D\u0026token=_HAdUpwWmet0TOTe2PSiJuMntExoshbm1kh2wQzzzAA\u0022]","data":"","settings":null}]
</script>

但它在空div中加载块:

<div><div class='custom_block'>...</div></div>

如何删除空div或禁用我的块的drupal-ajax?

0 个答案:

没有答案