Questions tagged [blocks]

In Drupal, a self-contained collection of content and functionality that is displayed in theme regions is called block.

Filter by
Sorted by
Tagged with
-1
votes
0answers
35 views

Configuration form doesn't allow to set the node type, the page on which the block should be displayed, the roles

My customer has a problem with blocks in a Commerce installation with Drupal 8.9.19 hosted on a shared hosting with Linux. Suddently the configuration of the block looks strange. It isn't possible to ...
1
vote
0answers
26 views

Register form block into modal

I want to display the register form in a modal. For that, I created a custom plugin block which returns the rendering of the form register. /** * {@inheritdoc} */ public function build() { $...
0
votes
0answers
28 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
0answers
61 views

modify custom block using hook_entity_type_view_alter()

In Drupal 9, I am trying to use hook_ENTITY_TYPE_view_alter() to modify the body field of a custom block. However, I don't know how to access the data in the $build array to change it. This is a ...
0
votes
1answer
36 views

How to use hook_block_access() with custom block created in UI

I have a custom block created using Drupal 9 Custom block library. I want to use hook_block_access() to control access to it, but, as it is a custom block, it does not have a block machine name. The ...
0
votes
0answers
14 views

Using a View Page and it's exposed filters as separate blocks on same page

I have created a view page that exposes some filters, and I put this view on my front page. When creating a page in Drupal 7, I was able to add the exposed filters as a piece of content that was found ...
0
votes
0answers
35 views

admin/modules takes 40 seconds to load after uninstalling custom module

During the development, I made a couple typos in the block which resulted in Drupal seeing the module as being deleted without having been uninstalled first. When I realized what I had done, I put ...
-1
votes
1answer
49 views

Show two content types in same view

Drupal 8 newb here, I have two basic types I need to show in my front page: There’s a “Restaurants” content type and a “Chefs” content type. These are shown in my site like this: The types are ...
0
votes
0answers
35 views

Is a block the same thing as content?

I'm new to Drupal and I would like to know how to manage content in a block. This is what I understood so far: The Drupal page is divided into regions and each region consists of one or more blocks ...
0
votes
0answers
24 views

Blocks activated on Article content type

My website has heading blocks that appear for certain pages and (as expected) I have to specify that each heading block should only appear for /node/xxxx. I have an Events content type, which are all ...
0
votes
0answers
22 views

The form argument Drupal\terminal\Form\TerminalCliForm is not a valid form

I've read through other questions regarding the same error message. They all seem to end up being due to typos or the file path. I don't believe that is the case here, but we'll see. I have a working ...
0
votes
1answer
33 views

How can I have a custom block show different content on the front page?

I have a custom module, in Drupal 9, (showing a block in a region) that has an admin form with a checkbox for showing only on the "front page" or if unchecked on "all" pages. In ...
0
votes
1answer
80 views

How to handle different output for a same block (Caching Problem)? [duplicate]

I have a theme which has two different appearance for main menu block, so I wrote a theme suggestion like this: function MYTHEME_theme_suggestions_menu_alter(array &$suggestions, array $variables) ...
0
votes
0answers
12 views

One Taxonomy with multiple views to show content related to a specific term and referenced content

I have two content-type: Job Organisation and a taxonomy: categories The content type "Job" has a field referenced to "categories" and another field referenced to "...
0
votes
0answers
41 views

How to get all the pages where a block is placed

If I have a block as an entity inside of the function hook_entity_update(), then how to get the paths of all the pages where the block is placed? Can't find an anwser via Google. Or maybe first I ...
0
votes
1answer
28 views

Show a block only in in the front page and not in every pager page

I configured a block to be shown only on the front page, but the front page is actually a view of the last published nodes, with a pager, and the block is shown on each of its pages. Is there any ...
1
vote
0answers
37 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? ...
0
votes
1answer
24 views

View with multiple blocks, how to specify which is shown?

I have a view that is placed as a block below my main content. Within that view I have block "displays". each having a different contextual filter for their id from url. The problem is when ...
2
votes
1answer
74 views

Can BigPipe exclude certain blocks?

I've got BigPipe enabled in Drupal 8, and it helps to make pages initially load faster. However, the header block is always one of the blocks that loads in on a delay, which visually looks bad since ...
0
votes
2answers
50 views

"block_name" not found

I installed the Twig Tweak module. {{ drupal_block('block_name') }} doesn't work. In Drupal logs I get the error The "block_name" was not found "block_name" I get from the ...
0
votes
0answers
28 views

Pass parameters from block to a JSON endpoint using taxonomy term from URL

I've been searching for a solution to being able to pass a taxonomy term on a views block that is on a given page using the term name that is in the URL. I agree with my team that it would be a best ...
0
votes
0answers
29 views

How do I set up a views block that filters contextually on a field included in a paragraph?

I have two content types (ContentA, ContentB) which both use the same paragraph (MyParagraph) as field type “Entity reference revisions.” MyParagraph consists of two “List (text)” fields: ...
0
votes
1answer
60 views

Display Block to retrieve information from Order Item's Product Variant and display rating & review inside product page

I am working on an e-commerce website development. I have the conventional Products -> Product Variants which goes through Order and payment gateway workflow. However, there is something different ...
-1
votes
1answer
34 views

Maestro workflow status block

After adding the Maestro status block to my homepage-content region, it doesn't display the status bar nor the status messages which were set in the workflow. It displays only the workflow title. 3 of ...
0
votes
0answers
76 views

Sharing Heavy Operations between multiple Page Elements

I have a page with two separate page elements. One is a table-select form that shows an extensive list of content data. The other page element is a block that shows a summary of that same content. ...
0
votes
0answers
24 views

How can I show a flipbook as block in the front page?

I've installed the FlipBuilder module that's created via the software and can view the flipbook on its own url, but I want to put a copy of my flipbook on the front page, in its own block or in a ...
3
votes
1answer
65 views

How to invalidate the block list cache?

I need to invalidate the block list cache each time a new configuration entity is created, this is because I have a derivative block to handle dynamically one block for each of my configuration ...
3
votes
0answers
66 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 ...
-1
votes
1answer
24 views

Change Block view using custom Views

I have one content type(Contains Image & body field). for that, I have created a custom block view using Views. currently, it's showing content like on the left side the image is placed and on the ...
1
vote
1answer
20 views

How to display 'Welcome [first_name] [last_name]' in a custom views block? D8

I would like to create a custom block / view to display a welcome message to the currently logged in user in Drupal 8. I followed this answer but it isn't working for me. Maybe things changed in D8. ...
0
votes
1answer
59 views

What is the equivalent of Joomla's {loadposition} and {loadmodule}?

I have recently converted from Joomla to Drupal. I am still learning how to use it but I can't seem to find answers (esp for Drupal 9 not some ancient version usually coming up with google search) how ...
0
votes
0answers
23 views

ckeditor not loading rich text editor by default

I'm running CKEditor 7.x-1.19 with Drupal 7.80. With "Default editor state" set to Enabled, and "Show the disable/enable rich text editor toggle" set to Show, my system is still ...
-1
votes
1answer
35 views

Add custom form to content type (Basic Page or any) using custom extesnion

I am new to Drupal. Actually, I have to add a custom form to the content type and it will be visible to the frontend user where they can submit their response. So I have created the form and save the ...
-1
votes
1answer
20 views

How to add anchor to a single block displayed on specific pages within the same page?

I have a basic layout for a Drupal 8 site, created two blocks with block 1 containing menu with static content and links to pages, and block 2 for subscription form, The block 1 and block 2 are called ...
0
votes
1answer
30 views

Trouble accessing twig variables passed from custom block

I've looked through many similar questions and can't figure out what I'm missing. I have a custom module with a block... /** * Provides the 'Four Words' block * * @Block( * id = "...
1
vote
1answer
36 views

How to set the href with the pathname of the current page in it?

Inside a view I have a block for which there is a field called Global Perspective. Inside the block override , I have rewrite rules which overrides teh out of the field with custom text. <div class=...
0
votes
0answers
39 views

Setting visibility by content type while adding block to region from code

I created block from code. Now I want to add it to specific region ('sidebar_first') also from code. I'm doing it like this: function event_block_preprocess_page(&$vars) { if (\Drupal\block\...
0
votes
1answer
24 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 ...
0
votes
0answers
37 views

Create multiple Menu blocks from the same menu

In Drupal 7, the Blocks page contained a link for 'Add menu block', from where you could create multiple menu blocks of the same menu. In Drupal 8, menu blocks seem to be generated automatically, ...
0
votes
1answer
49 views

How to get a custom block form in another custom block?

I have a custom block /** * Provides block A. * * @Block( * id = "block A", * admin_label = @Translation("Block A"), * ) */ class Block A extends BlockBase implements ...
0
votes
1answer
23 views

Block the node which I am currently in

I am discovering one problem on my page - as a content I have some recipe. Under it, I've created a block which is displaying "Simular recipes". And now, this block is displaying some ...
0
votes
0answers
22 views

Replace Block on click of form element

I have a block which contains a form (I used the build() method) . One of the form elements has a suffix as follows: $form['test'] = array( '#type' => 'number', '#placeholder' => t(...
0
votes
0answers
50 views

Why does my custom block disappear after page reload?

I have created a custom block with a custom module (Example: https://www.webwash.net/programmatically-create-block-drupal-8/). The goal is to display some external content, which is working. The only ...
0
votes
1answer
101 views

How to deal with block cached for anonymous user?

I have placed in the site's home, via twig, a views block of nodes with a random sort and obliviously no cache active. Therefore, at each page reload different nodes appear. The problem is that block ...
1
vote
2answers
158 views

Pass value into a view using block input

I have created a Drupal 9 site with articles that belongs to taxonomy terms. I want to give the ability to the administrator of the site to place a block with whatever taxonomy he wants. How would I ...
0
votes
0answers
166 views

How add a paragraph field to a form programmatically?

I'm on Drupal 9. I am creating a custom block programmatically with some fields in the configuration form. However, I need to add a paragraph field and I've found no documentation\working way to do so....
0
votes
1answer
32 views

Is there a way to see all the available variables inside content?

I am using Drupal 9 with twig files I have a page where in one section I need to show thumbnails of the latest posts. So I created a new view as a block, and placed this block under Content in admin/...
0
votes
1answer
75 views

Negate a block visibility condition [closed]

Found it useful and did not find any contributed module to fulfil this so, adding it for knowledge purpose. Stuck in a situation where we need to hide a block for certain role. Drupal 8 has ...
0
votes
1answer
127 views

Clearing the render cache after being programmatically logged in

This issue is on a Drupal 8 site. I have no reason to think it would behave any different on Drupal 9. We have a scenario where we are having trouble with caching of a custom block. This block ...
0
votes
0answers
19 views

Show book tree from page on down

Using Views I've created a block which show the immediate children of the current parent book page. What I really want is a block that shows the total child hierarchy of the current parent book page. ...

1
2 3 4 5
56