Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, editing the layout of a content type under /admin/structure/types/manage/event/display/default/layout is hard with viewfield - because the viewfield output is invisible while editing. Please, see screenshot.
(The field works correctly on nodes, though)
The output of a working entity reference field:
<div data-layout-content-preview-placeholder-label=""Related Events" field" class="js-layout-builder-block layout-builder-block contextual-region clearfix block block-layout-builder block-field-blocknodeeventfield-related-events" data-layout-block-uuid="848bb84c-dbd2-46e4-b2df-690f936dd963" data-layout-builder-highlight-id="848bb84c-dbd2-46e4-b2df-690f936dd963">
<div data-contextual-id="layout_builder_block:section_storage_type=defaults&section_storage=node.event.default&delta=1&region=first&uuid=848bb84c-dbd2-46e4-b2df-690f936dd963:operations=move%3Aupdate%3Aremove&langcode=en" data-contextual-token="Sr-gNLxSkerAqVRz7D8C1SCyOQUwPr9lKAWL8x-USqM" class="contextual"><button class="trigger focusable visually-hidden" type="button" aria-pressed="false">Open configuration options</button><ul class="contextual-links" hidden=""><li class="layout-builder-block-update"><a href="/layout_builder/update/block/defaults/node.event.default/1/first/848bb84c-dbd2-46e4-b2df-690f936dd963?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Configure</a></li><li class="layout-builder-block-move"><a href="/layout_builder/move/block/defaults/node.event.default/1/first/848bb84c-dbd2-46e4-b2df-690f936dd963?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Move</a></li><li class="layout-builder-block-remove"><a href="/layout_builder/remove/block/defaults/node.event.default/1/first/848bb84c-dbd2-46e4-b2df-690f936dd963?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Remove block</a></li></ul></div>
<div class="content">
<div class="field field--name-field-related-events field--type-entity-reference field--label-above field--entity-reference-target-type-node clearfix">
<div class="field__label">Related Events</div>
<div class="field__items">
<div class="field__item"><a href="/klient/karme/events/595" hreflang="en" tabindex="-1">PM-Management</a></div>
</div>
</div>
</div>
</div>
The output of the viewfield seems incomplete:
<div data-layout-content-preview-placeholder-label=""Relating Events" field" class="js-layout-builder-block layout-builder-block contextual-region clearfix block block-layout-builder block-field-blocknodeeventfield-relating-events" data-layout-block-uuid="26c37294-5328-4d8c-b6b4-97d52d279021" data-layout-builder-highlight-id="26c37294-5328-4d8c-b6b4-97d52d279021">
<div data-contextual-id="layout_builder_block:section_storage_type=defaults&section_storage=node.event.default&delta=1&region=first&uuid=26c37294-5328-4d8c-b6b4-97d52d279021:operations=move%3Aupdate%3Aremove&langcode=en" data-contextual-token="2uvIgRUdu1j16FHNkn70Fx8uTiKGkjCdi473XiX0USI" class="contextual"><button class="trigger visually-hidden focusable" type="button" aria-pressed="false">Open configuration options</button><ul class="contextual-links" hidden=""><li class="layout-builder-block-update"><a href="/layout_builder/update/block/defaults/node.event.default/1/first/26c37294-5328-4d8c-b6b4-97d52d279021?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Configure</a></li><li class="layout-builder-block-move"><a href="/layout_builder/move/block/defaults/node.event.default/1/first/26c37294-5328-4d8c-b6b4-97d52d279021?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Move</a></li><li class="layout-builder-block-remove"><a href="/layout_builder/remove/block/defaults/node.event.default/1/first/26c37294-5328-4d8c-b6b4-97d52d279021?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Remove block</a></li></ul></div>
<div class="content">
<div class="field field--name-field-relating-events field--type-viewfield field--label-">
<div class="field__label"></div>
</div>
</div>
</div>
Here is a comparison:
--- C:/tmp/reference.txt Mi. Apr 15 11:34:47 2020
+++ C:/tmp/viewfield.txt Mi. Apr 15 11:34:32 2020
@@ -1 +1 @@
-<div data-layout-content-preview-placeholder-label=""Related Events" field" class="js-layout-builder-block layout-builder-block contextual-region clearfix block block-layout-builder block-field-blocknodeeventfield-related-events" data-layout-block-uuid="848bb84c-dbd2-46e4-b2df-690f936dd963" data-layout-builder-highlight-id="848bb84c-dbd2-46e4-b2df-690f936dd963">
+<div data-layout-content-preview-placeholder-label=""Relating Events" field" class="js-layout-builder-block layout-builder-block contextual-region clearfix block block-layout-builder block-field-blocknodeeventfield-relating-events" data-layout-block-uuid="26c37294-5328-4d8c-b6b4-97d52d279021" data-layout-builder-highlight-id="26c37294-5328-4d8c-b6b4-97d52d279021">
@@ -3 +3 @@
- <div data-contextual-id="layout_builder_block:section_storage_type=defaults&section_storage=node.event.default&delta=1&region=first&uuid=848bb84c-dbd2-46e4-b2df-690f936dd963:operations=move%3Aupdate%3Aremove&langcode=en" data-contextual-token="Sr-gNLxSkerAqVRz7D8C1SCyOQUwPr9lKAWL8x-USqM" class="contextual"><button class="trigger focusable visually-hidden" type="button" aria-pressed="false">Open configuration options</button><ul class="contextual-links" hidden=""><li class="layout-builder-block-update"><a href="/layout_builder/update/block/defaults/node.event.default/1/first/848bb84c-dbd2-46e4-b2df-690f936dd963?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Configure</a></li><li class="layout-builder-block-move"><a href="/layout_builder/move/block/defaults/node.event.default/1/first/848bb84c-dbd2-46e4-b2df-690f936dd963?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Move</a></li><li class="layout-builder-block-remove"><a href="/layout_builder/remove/block/defaults/node.event.default/1/first/848bb84c-dbd2-46e4-b2df-690f936dd963?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Remove block</a></li></ul></div>
+ <div data-contextual-id="layout_builder_block:section_storage_type=defaults&section_storage=node.event.default&delta=1&region=first&uuid=26c37294-5328-4d8c-b6b4-97d52d279021:operations=move%3Aupdate%3Aremove&langcode=en" data-contextual-token="2uvIgRUdu1j16FHNkn70Fx8uTiKGkjCdi473XiX0USI" class="contextual"><button class="trigger visually-hidden focusable" type="button" aria-pressed="false">Open configuration options</button><ul class="contextual-links" hidden=""><li class="layout-builder-block-update"><a href="/layout_builder/update/block/defaults/node.event.default/1/first/26c37294-5328-4d8c-b6b4-97d52d279021?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Configure</a></li><li class="layout-builder-block-move"><a href="/layout_builder/move/block/defaults/node.event.default/1/first/26c37294-5328-4d8c-b6b4-97d52d279021?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Move</a></li><li class="layout-builder-block-remove"><a href="/layout_builder/remove/block/defaults/node.event.default/1/first/26c37294-5328-4d8c-b6b4-97d52d279021?destination=/admin/structure/types/manage/event/display/default/layout" class="use-ajax" data-dialog-type="dialog" data-dialog-renderer="off_canvas">Remove block</a></li></ul></div>
@@ -5,5 +5,5 @@
- <div class="field field--name-field-related-events field--type-entity-reference field--label-above field--entity-reference-target-type-node clearfix">
- <div class="field__label">Related Events</div>
- <div class="field__items">
- <div class="field__item"><a href="/klient/karme/events/595" hreflang="en" tabindex="-1">PM-Management</a></div>
- </div>
+
+ <div class="field field--name-field-relating-events field--type-viewfield field--label-">
+
+ <div class="field__label"></div>
+
@@ -13,3 +13 @@
- </div>
-
-
+ </div>
Where the essential difference is :
Working entity reference field:
<div class="content">
<div class="field field--name-field-related-events field--type-entity-reference field--label-above field--entity-reference-target-type-node clearfix">
<div class="field__label">Related Events</div>
<div class="field__items">
<div class="field__item"><a href="/klient/karme/events/595" hreflang="en" tabindex="-1">PM-Management</a></div>
</div>
</div>
And the output of the invisible viewfield:
<div class="content">
<div class="field field--name-field-relating-events field--type-viewfield field--label-">
<div class="field__label"></div>
</div>
Hope this helps - Viewfield is one of the most important modules!
Comment | File | Size | Author |
---|---|---|---|
2020-04-15_11h38_29.png | 37.23 KB | maxilein |
Comments
Comment #2
maxilein CreditAttribution: maxilein commentedUsing D 8.8.5
Comment #3
jerdavisI'm unable to reproduce this. On 8.8.5 with current code from Viewfield 8.x-3.x branch, the view output is rendering in Layout Builder when editing the layout on an individual node. In the content type default layout it shows as a placeholder.
What version of Viewfield are you using?
Comment #4
jerdavisComment #5
maxilein CreditAttribution: maxilein commented8.x-3.0-beta5
I'm editing in the content type default.
What else could I try to get you more info?
Maybe this:
I have two viewfields there. One is rendering fine. The other as laid out here.
Maybe the view does not get the nid passed as a parameter? Then it would be empty, but it should be shown as a proper placeholder...
Comment #6
jerdavisCan you provide screenshots of the field configurations and the full screen where this issue is occuring?
Comment #7
maxilein CreditAttribution: maxilein commentedI will. asap. R