Questions tagged [layout-builder]
The layout-builder tag has no usage guidance.
60
questions
0
votes
0
answers
18
views
Custom block translations
I have build custom sections and blocks to provide for the layout builder.
Here is an example of my block code:
<?php
namespace Drupal\hs_blocks\Plugin\Block;
use Drupal\Core\Block\BlockBase;
...
0
votes
1
answer
45
views
Access preprocess variable globally
I am trying to get the Custom Block type fields using a preprocess hook. I can successfully use the following code.
function theme_preprocess_block(&$variables) {
$content = $variables['elements'...
0
votes
0
answers
23
views
I having trouble getting Layout Builder Styles Module to work correctly
I'm trying to use Layout Builder Styles on Drupal 9 to style my blocks and sections in layout builder. The problem is none of the styling is being applied to the displayed content.
This is the ...
0
votes
1
answer
91
views
How to programmatically save a node's layout?
Not sure if this is the best approach but it does work well.. almost.
I am using the Layout Builder Modal module which, in layout builder, opens block configuration in a modal. This is great but I ...
-2
votes
1
answer
81
views
Programmatically adding block into layout builder layout?
I'm trying to add a block into a layout builder, but it seems the 'getSections' for a node which is currently at the default layout does not output anything, not sure if it's a bug or if that's ...
1
vote
0
answers
15
views
Why is the order/weight of blocks added to region not saved?
I have used layout builder to manage display on the default display of a content type.I have not selected "overrides allowed" so that this is the global layout for this content type. I see ...
0
votes
1
answer
31
views
How to pass Block ID to a view?
I have a Custom Block type called HomeBlocks. This bundle has a paragraphs field which allows multiple paragraphs.
I then place (using Layout Builder) an instance of this block type on my home page (a ...
0
votes
2
answers
21
views
How to list Links/Attachments in sidebar second
When managing fields for a given content type in Drupal 9, I would like to be given the option to list all items of a given field (e.g. Links, Attachments, ... ) in a specific region (say, sidebar ...
0
votes
1
answer
40
views
How do I add styles to regions?
In Drupal layout builder I may have a section with several drag and drop regions. Each region can contain multiple components (fields for example). I would like to add a style to the region - not the ...
0
votes
1
answer
45
views
Add a new contextual link to custom block type to edit layout
I have a custom block type using Layout Builder.
How do I add an Edit Layout item in the contextual link menu?
The link should go to /block/{nid}/layout; after saving, the layout returns to where you ...
0
votes
1
answer
31
views
Main page content block doesn't move
I'm currently building a Drupal 9 site.
I've built some custom blocks, which I display on a specific 'basic page'.
I want the 'Main Page Content' block to be above my custom blocks. So I moved the '...
0
votes
0
answers
16
views
Access block content data from blocks inserted in the layout builder via Restful API
I am looking for a way to access the block content data from blocks that were place in the layout builder. I am looking for a way to do it using the Restful WebService module and not JSON-API.
I know ...
4
votes
1
answer
94
views
Enable layout builder on custom controller page
I created a simple page in a controller class:
public function taxonomyPage($term) {
return [
'#type' => 'markup',
'#markup' => $this->t('<p>Need to render layout ...
1
vote
1
answer
125
views
Drupal 8/9 Layout Builder and default custom block
We have a number of custom blocks that we've created, and use Layout Builder so that our authors can just drag and drop as needed. We have one Hero block in particular that we would like to see on ...
0
votes
0
answers
10
views
how to implement 'most viewed/popular' content displayed in the sort filter [duplicate]
I tried with radioactivity but its not working as expected because we are using layout builder for our content types.
0
votes
0
answers
18
views
Does Views block caching include language in cid?
I think this is likely a core bug (in which case I know it is not meant for Drupal Answers) but thought I would check here first to see if possibly I have just missed something in configuration?
I ...
0
votes
0
answers
15
views
How can I remove the configuration side panel?
I have two drupal websites (running on Drupal 9.2.10). Both of them use modules:
Layout builder
Layout Builder Asymmetric Translation
Both websites have same configuration (and I don't do any theme ...
1
vote
1
answer
116
views
How to translate the layout builder blocks of a node programmatically?
I am translating the nodes programmatically. Everything works fine except the layout builder blocks.
When I try to translate it, it also changes on the source node.
I have created a node in language ...
1
vote
1
answer
218
views
How to alter Layout Builder block visiblity?
Is there a hook to alter block access for blocks placed using Layout Builder? I see there is hook_block_access; but sadly this is not triggered when the block is placed using Layout Builder.
There is ...
0
votes
1
answer
42
views
How to pass Paragraph ID from Layout Builder to Views?
This is a bit convoluted; so hopefully it makes sense:
I have a parent entity: Event. Event has a Paragraph field on it: Sessions (paragraph type: Session).
I use Layout Builder to format the Full ...
0
votes
0
answers
41
views
Create a list of blocks and the pages they are currently being used on
We have a D9 site that makes extensive use of Layout Builder. One of the features our content editors use is creating a global custom block in the Custom Block Library and then on various pages they ...
0
votes
1
answer
173
views
Custom block plugin does not show in Layout Builder options
Newish to Layout Builder - we made a custom block plugin that renders a custom form. When I go to a page with Layout Builder and try to add that block... it is not in the list of blocks.
/**
* ...
0
votes
1
answer
45
views
Argument 6 passed to Drupal\layout_builder\Plugin\Block\InlineBlock::__construct() must implement interface Drupal\Core\Session\AccountInterface
I was upgrading Drupal 8 to 9. I installed 'Upgrade Status' module and fixed as suggested by it. Now it was time to upgrade to D9. I changed on composer.json.
"drupal/core-composer-scaffold":...
0
votes
0
answers
88
views
Unexpected error from a layout page
I am working with Manage display, but for one of my pages I get an error occurring on the Layout page.
Error: Call to a member function getEntityTypeId() on null in
Drupal\layout_builder\Plugin\Block\...
3
votes
1
answer
174
views
Prevent rendering of Layout Builder regions that have no content
Using Layout Builder, when you add a block to a layout that has access controls and a user visits a page without access, the layout is empty.
How does one prevent the layout from rendering at all if ...
0
votes
0
answers
48
views
Is there a way to specify which content should be shown from the the "Entity View (Content)" block?
As part of CTools, there is the "Entity View (Content)" block that can be used in Layout Builder, but that only shows the current content. Is there a way to specify another piece of content?
...
3
votes
0
answers
20
views
QuickEditIntegration can't process components for Quick Edit
I have a content type that is displayed with Layout Builder. When I view it in default mode, the Quick Edit option does not appear in the contextual menu. This is because none of the fields have the ...
1
vote
2
answers
61
views
How to restore layout builder override layouts from old DB snapshot?
After upgrading from Drupal v9.1.7 to v9.2.0, on a lot of nodes the custom layout builder override layouts were reset to the default layout, resulting in a massive data loss. To make things worse, ...
1
vote
0
answers
49
views
Why do drupal-media elements not get rendered in Layout Builder CKEditor?
In Layout Builder, add a custom block.
When editing the block in CKEditor, add an image using "Insert from Media Library" button.
Exit CKEditor.
Re-edit the block in CKEditor.
Result: I do ...
3
votes
1
answer
171
views
How to setup access dependency on a block content created programatically
In Drupal 8, I am creating block instances (BlockContent) for node layouts programatically and setting them all as non-reusable. That causes a following access error: "Non-reusable blocks must ...
0
votes
0
answers
36
views
How do I build custom options for sections?
I manage to build/define some custom blocks with my own parameters/form elements when placing them, so I'm looking to do the same with sections. I've seen that the core code does that, but ideally I ...
0
votes
1
answer
94
views
Unable to edit custom block without administrator permissions
I created a content type "landingpage" and a user role "editor". I enabled layout builder for this content type and enabled the option to overwrite the the layout for individual ...
1
vote
1
answer
150
views
Programmatically enable the entity view display
I would like to programmatically enable the Layout Builder module. I followed the instructions given on Layout Builder — building Drupal 8 layouts, but they don't seem to work. They might be outdated ...
1
vote
2
answers
125
views
Import single view configuration fail - layout_builder__layout will not exists after import
I have Drupal 8.9.13 and I want to export/import single views configuration to other Drupal 8.9.13. I can select single view to export, but when I import it I get the next error:
The configuration ...
0
votes
1
answer
42
views
icon_map in PHP annotation instead of layouts.yml
I need to add an Icon to a layout added by a contrib module. But I see it is adding the layout via plugin PHP file instead of layouts.yml.
The annotation looks like following
/**
* A very advanced ...
0
votes
1
answer
70
views
How do I attach a single-use block through a field?
I am working on a project that has a lot of custom block types (about 35). They are complex and have a lot of fields. They are being used with Layout Builder so all the blocks that get created are ...
0
votes
1
answer
275
views
How do I update the section component configuration?
How to update a component in the node's layout builder? I have used the following code.
$node = \Drupal\node\Entity\Node::load($nid);
$layout = $node->get('layout_builder__layout');
$sections = $...
0
votes
1
answer
296
views
Pre process a template that uses layout display
I want to preprocess a user account display. I want to manipulate a field value at display time.
for example, i want to change:
field_prefered_color: redto :
field_prefered_color: red - Cool, that is ...
1
vote
1
answer
392
views
How do I store custom block content as configuration?
I'm creating custom pages using Pages + Layout Builder. These layouts need to be stored in GIT as config files (drush cex). Currently, the layouts themselves are stored fine.
The main problem is that ...
0
votes
1
answer
52
views
How do I create custom layouts for Panelizer?
I was wondering how do you create custom layouts for Panelizer in D8? In D7, I can easily create my layouts, and just add a couple of lines on my .info file to let Drupal know where my layouts are.
I ...
0
votes
0
answers
71
views
bootstrap_barrio subtheme breaks ckeditor's media insert in custom block
I'm facing this problem (seems to be producible) in a contrib theme that breaks the ckeditor media insert button on custom blocks in the layout builder of individual nodes...
The javascript error says ...
0
votes
0
answers
204
views
How to set an ALL option on contextual filters passed to a view with twig tweak?
In Drupal 8, I have a twig tweak embedded view that passes variables from the Layout Builder dialogue to filter results in a custom block.
{% set event_type = block.field_filtered_events_event_type....
-2
votes
1
answer
49
views
Missing some block fields
I'm working with layout_builder and page_manager together and I'm having some issues.
I want to add an existing node to my right sidebar, but I don't see the option anywhere where I can do that.
In D7,...
1
vote
4
answers
2k
views
How to export the config files of a content type to a module?
I have a custom module. I created a content type and added some fields to that content type. I also enabled the layout builder on the manage display of the content type
Then I run drush -y cex to ...
1
vote
0
answers
42
views
Create a layout on a user route
I'm trying to add a Moderation Dashboard tab to the user page like the Moderation Dashboard module, but I can't use Panels. Is it possible to create a layout on a route using layout builder?
I've ...
1
vote
1
answer
1k
views
How do I remove an unused patch?
I'm trying, for the first time, to add a patch in composer.json, for a layout builder issue (https://www.drupal.org/project/drupal/issues/3045171#comment-13450756).
It's the first time I do it, I see ...
0
votes
0
answers
226
views
Change the width of the off-canvas dialog
Layout Builder uses the off-canvas dialog. It comes out from the right side of the screen at a max width of 300px. We'd like to make it wider. I can do this with a powerful CSS rule, but is there a ...
1
vote
1
answer
70
views
Unable to see page context in cache context
I created a page using Page Manager with Layout Builder. I created a path called: /my-account/{agent_number} witch allows me to create the agent_number string context. I created my own custom block ...
0
votes
1
answer
81
views
Solr Search Custom search form template
I have solr search setup on my drupal8 website. I have a view setup that has two pages in it. I have the search box via an exposed form placed as a block in my header region.
What I want to do is to ...
0
votes
1
answer
368
views
How do I use the administrative theme?
I'm building a custom Drupal theme and wondering if there is a way to get the modal windows to use the default admin theme. I'm using the Layout builder module with a custom block that uses the Media ...