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
0
votes
0answers
13 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
vote
0answers
20 views

Blocks not displaying on the page

I am working on an already built drupal website. I have created a landing page and for an existing view with multiple blocks, I added one more block to it. The content appears on the auto preview of ...
-2
votes
0answers
20 views

Show a block only for a limited period of time after the page has been served [closed]

How could I show a view or block only for 10 seconds after the page has been served? The ideal would be to show it when users reach the end of the page, but it is a view with infinite scroll. If I do ...
-1
votes
1answer
31 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
74 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. ...
-1
votes
0answers
23 views

Show Content Related to this nodes Content

I have a site for upcoming events which uses two content types: Venue and Event. Event contains a entity reference field (field_event_ort) for Venue. I would like to build a block shown for Venue ...
0
votes
0answers
18 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
58 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
49 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
17 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
58 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
16 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
33 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
18 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
29 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
38 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
16 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
47 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
22 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
44 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
82 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
106 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
99 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
61 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
86 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
15 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. ...
0
votes
0answers
32 views

How do I get theme suggestions for a custom block attached via an entity reference field?

I have created a custom block type with the machine name "score_card". I am displaying it on a node page via a paragraph with an entity reference field that references blocks. I would like ...
1
vote
1answer
45 views

Template suggestion does not work for table in a custom block / Might there be a way around?

I created a block on pages of the "Author" content type that lists all the articles the author has contributed to in a table (via contextual filter). Now I want to customize the table layout....
1
vote
1answer
39 views

Entityqueue - Get field values from the queue

First off, i'm very new to Drupal. Kindly help me and forgive if im being a noob. Im using the module - Entityqueue https://www.drupal.org/project/entityqueue Im created a view block for a entity ...
0
votes
0answers
34 views

How selectively print the content of region.html.twig

I'm trying to modify the html of region.html.twig I've used a hook to override the suggestion: function my_theme_theme_suggestions_region_alter(array &$suggestions, array $variables) { if($...
0
votes
1answer
19 views

Place custom block on particular content type pages and home page

I have a custom block which I want to place on all the pages of one content type AND on the home page. The home page is a custom twig file that pulls in the region where the block is placed. Right now ...
0
votes
1answer
31 views

Force an image to display as block (not inline)

I have a field of type image that I would like to display in a column alone, with all following content displaying beneath, even if the image width is narrower than the width of the display. Even when ...
0
votes
1answer
33 views

How do I create a block in a module that can be referenced via an entity reference field?

I'd like to be able to reference my programmed block as a field in a paragraphs. I've Generated a module with drupal console - drupal generate:module Used the template for a block from the example ...
-2
votes
1answer
42 views

Getting current user ID in a custom block [closed]

I have a custom block where I need to use [current-user:uid] in just one text. In Drupal 7, I would have used PHP input filter. How can I do this in Drupal 8?
0
votes
0answers
12 views

Hide a block from the “Place block” list

I have a custom module that defines a series of blocks. Depending on the configuration of the module, I'd like to hide blocks from "Place block" block layout list unless they're enabled. Is ...
0
votes
1answer
13 views

Can I add a custom block?

I want to have a block with 3 text body fields. I've done this before in Drupal 8 where I created a custom block and was able to add different fields to it. In my Drupal 7 setup, I can add a block but ...
0
votes
0answers
32 views

I've placed blocks in hidden region, now no login to admin possible

I made a site in Drupal 9. I played a bit with blocks and I think I placed an important block in the hidden region. Now the login page doesn't show the login form anymore. The header, footer and some ...
-1
votes
1answer
58 views

How to render a custom block in a twig file?

I created a custom block named "Alert Bar" in the "navigation" region and I want to render it in my header file. My header file currently has code like this to render the blocks - {...
-2
votes
1answer
63 views

Why is my custom block template not being picked up?

I am working on a custom slider programmatically. I create a custom module (block_example) and make a block (BlockExample.php) and a twig file (blockexample.html.twig) and also a module file (...
0
votes
0answers
18 views

How do I get information from build method into render array and rendered?

I have a region that I need to sometimes render differently, based on a value in the build method. The build array has the correct information, but by the time it gets the preprocessor its gone and ...
0
votes
1answer
18 views

Can use Webform for add combobox for select language on the site?

I want to know how I can add a combobox to a page. For example, on the front page, I want to add a combobox for selecting the language. I use the default modules for creating multilingual sites. ...
0
votes
1answer
22 views

Change max length of title in a custom block added via a template file

A drupal 7 website has a custom block added via a template file. The block displays previews of article content type belonging to a certain rubric. It uses the following line to do so: $block = ...
0
votes
0answers
29 views

Editing block content: empty block body

I've been asked to support a drupal website. The website has a block that has content in it. When I locate the block in /admin/structure/block/block-content, the "block body" section is ...
1
vote
0answers
18 views

Access custom block link field url in twig template

I have a custom block with four fields like this : I want to display in twig the value of image's uri. I've tried something like that in field--block-content--field-linkedin-link--rs.html.twig ...
0
votes
0answers
45 views

Placing a block on an entity

I am aiming to place a block on an entity. It seems like this should be simple as entity integration in D8 is well-developed and (in parts) user-friendly. I can get the view block working fine and can ...

1
2 3 4 5
56