Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [blocks]

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

0
votes
0answers
4 views

multiple view block by term that list node title tagged with child term

I want to display a view where multiple block are specific to first level term of a vocabulary and that it list all the node tagged with all the child term of that term with deep. I could create each ...
0
votes
0answers
11 views

Getting 403 Error with Slick and Flexslider

Can't seem to figure this one out! First, I tried Flexslider and then I tried Slick. I am getting the same errors (except different but corresponding files associated with each) with both. HTTP403: ...
0
votes
0answers
17 views

How do I locate a specific module, block, view, or node responsible for social sharing buttons? [on hold]

I am working on a site built by another developer with what I believe is deprecated code being used for the social sharing buttons. The "count" function recently stopped working. I located code in the ...
0
votes
2answers
46 views

Print a view inside a block

In Drupal 7, I use the following code to print more than one view inside a block. <?php print views_embed_view('view_name', 'display_name'); ?> In Drupal 8, it doesn't work and it returns ...
0
votes
0answers
13 views

How can I enable a block, set the pages it is visible on, and dynamically change the contents of the block from inside my custom module? [on hold]

I have a custom module in Drupal 8 called hello world. in that module I make a custom block called Hello World!, I am trying to enable the block and set it's region to "sidebar_second" from inside my ...
1
vote
2answers
98 views
+100

Delete a block of all layouts

I am using Layout Builder (Drupal 8.7.1) I have a block in several Layouts. How can I programmatically remove all instances of this block and update all layouts without the message "This block is ...
0
votes
1answer
15 views

D7 block view to only show child nodes based on taxonomy

Using Drupal 7 I have a hierarchical taxonomy each node in the site is assigned a taxonomy to identify where it sits in the site structure. On certain pages (landing pages) I would like to show the ...
0
votes
1answer
25 views

Editing CSS without module/plugin

I am working on a website developed by a previous developer so I am studying how I can edit the style without source code or any extension... is there any possibility to do it?
-1
votes
0answers
16 views

How to use Ajax to dynamically render a new paragraph with DB data?

I'm kinda starting with Drupal 8 and I need some help. I have a dropdown in a custom block which options are taken from a DB. Now, I would like to create an Ajax callback that could take the value ...
0
votes
1answer
28 views

How to get the list of blocks for the current page?

I'm trying to get the list of all blocks for a certain page, but I can't figure how to do that. How do I get the list of all the blocks that are rendered for a page, independently from the region ...
0
votes
0answers
24 views

Twig and CSS for custom Block not working

I'm working on a custom module that has a block. This block has a form in configuration where user input the relative data, so far it works its saving the data and it display it but without a template ...
1
vote
1answer
20 views

How to render image uploaded from a configuration form

I'm working on a custom module, that contains a block and I'm currently having an issue to render an image that is being uploaded through a form at the configuration of the block. I'm getting this ...
0
votes
1answer
33 views

Output data of different content types in same page

I have two content types : Content type 1 named book with two fields author and language Content type 2 named movie with two fields date and resolution In my-theme/templates/page.html.twig I want to ...
0
votes
2answers
43 views

Can't edit block

I´m new with Drupal. I started a month ago with Drupal 8. Everything works fine. I had some own custom blocks. Then I added some javascript to one block. Immediately after that editing of the block ...
-1
votes
0answers
15 views

Is this a views contextual filter use case?

I am using FlexSlider to display images on various pages. The views block embedded on each page contains the flexslider where the views filter criteria specifies the taxonomy term by which to limit ...
0
votes
1answer
31 views

How do I convert "entity:node/9 in a link?

I need to get some values from a custom block I've created, and I am using the following code. // Get the block $block = \Drupal\block\Entity\Block::load('hightlight'); // Get the block content $...
-2
votes
0answers
11 views

Error when creating Pie Chart in Charts Module

When I try to create a pie or donut chart it gives me this error message: "Cannot read property 'color' of null". All other chart types work. Any idea why the module returns this error or how to fix ...
1
vote
1answer
14 views

Display a view block with a list of content excluding the one currently displayed on the page

I sometimes use contextual filters to display fields matching the content ID from url In that case , i would like to display a list of content as a view block , except the one that is displayed It ...
0
votes
1answer
20 views

Programmatically added block doesn't appear in block admin page

First of all, this is not a duplicate of this question, as I can't see my block even though I click Place Block. Below is my block class. To the best of my knowledge, it should appear in the list, ...
0
votes
1answer
43 views

How to chart data stored in a database table (dynamically) in Drupal 8?

I found these instructions for using the Charts module to display data from a database for Drupal 7: https://www.drupal.org/docs/8/modules/charts/charts-howtos/chart-some-data-stored-in-a-database-...
1
vote
0answers
50 views

Trouble Hiding Regions When Blocks Are Empty

Having trouble seeing why my regions render when I think they shouldn't... page.html.twig: {% if page.region %} {{ page.region }} {% endif %} region.html.twig: {% if content %} <div id="" ...
0
votes
0answers
45 views

Can't place a custom block

After adding a block file to src/Plugin/Block I can't add the block on the Block Layout admin page. When I filter by block name I can see it, but then when I try to place it I can't get to the ...
0
votes
0answers
30 views

How to set visibility configurations and third party setting in the block programmatically?

/** * Create Custom solutions blocks for Super Category and Category Pages. */ function custom_blocks_update_8008() { $values = [ 'uuid' => '7760fb2f-5235-4390-a91b-32568da6b001', '...
0
votes
1answer
22 views

How to get the View Object from ViewsBlock?

I'm loading a variable list of blocks. In some cases these blocks are a views_block type. When I load a views_block, the viewsblockbase provides the protected View object, but does not provide a ...
0
votes
1answer
41 views

Editing contents of custom block referenced in paragraph type, doesn't reflect changes in node where displayed

So, I have a Custom Block type, let's call it Sidebar Links Block. In an Article, we have a Sidebar paragraph type that allows quite a few different entities, one of which is the Article Sidebar Links ...
0
votes
0answers
27 views

Contextual links in block disabled when using Twig Tweak and UUID

In my taxonomy-term--NAME.html.twig I use a reference field to load a 'block_content'. {% for item in term.field_blocks %} {% set uuid = item.entity.uuid.value %} {{ drupal_block('block_content:'...
0
votes
0answers
11 views

Can I make a “type” available as a block?

I am trying to rebuild my links site in Drupal 8. In Drupal 7, I use a three-column panel page. I use a type to create the categories and with the node-block module I create the blocks. In Drupal 8, ...
2
votes
0answers
19 views

How do I access attributes from within a block?

So I'm calling a block within a HTML container in Drupal 7.x with a shortcode. There is an option for a Dynamic Shortcode as well but alas there is no documentation in the code base. [block admin_url ...
0
votes
0answers
16 views

Use machine name of blocks from parent theme

I have created a drupal 8 subtheme. I have some blocks that have twig template overrides in the parent theme based on custom block machine names. For example mywackynavbar. In the subtheme, I ...
0
votes
1answer
24 views

Block machine name is in use that is not available

I have a Site Branding block I style in my theme. To do this I give it a specific machine name, in this case: sitelogo On a site using that theme I am trying to create this block but when I try to ...
0
votes
0answers
17 views

How to keep a Form in a Block unique? [duplicate]

I have created a custom block containing a form. It works as long as there is only one block per page. But if there are more than one of these blocks, then the forms are not handled as unique forms. ...
0
votes
1answer
38 views

how to change h2 tag for div in block_view

I've created a block like this function mymodule_block_view($delta = '') { if($delta == 'myblock') { $block['subject'] = 'mytitle'; $block['content'] = myfunction(); } ...
0
votes
1answer
34 views

How do I include an affiliate script?

I am trying to add an affiliate script to my Drupal 7 website. I am doing this in a custom block. Specifically, I create a block, select the scripts text format in my WYSIWYG Editor, add the script ...
0
votes
0answers
23 views

Need to add custom block have previous, next and up links for book page

I am stuck in an issue where I need to create a side bar block on book pages. This block will contain links for: previous chapter, next chapter and up level. Tried searching on google. Also, tried ...
0
votes
2answers
56 views

Block machine name [duplicate]

How do i get the block machine name $block_id programmatically in Drupal 8? $block_id = 'machine_name_to_determine'; $block_config = \Drupal\block\Entity\Block::load($block_id);
0
votes
0answers
13 views

How do I make common blocks appear?

On Drupal 8, I am using the Search API and the Views modules to show search results in page mode. However, I am not able to find a way to display the generic blocks like NAV and Footer on this page. ...
0
votes
0answers
20 views

Access to a block view in a paragraph

I created a paragraph in drupal which has a reference to a block. In the preprocess I did : $variables['bloc_video'] = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($bp); ...
0
votes
2answers
60 views

How do I display username in a custom block?

Am new to Drupal so this is a very fundemental question. How do I display the current username ? In a custom Block? I beleive is the $user->name session variable. Do I create a Custom Block Type?...
0
votes
0answers
23 views

How can I add custom field to menu block?

I want to display a menu in my theme with an editable background. So I'm trying to add a custom field of type image on my menu block. I tried via HOOK_entity_base_field_info but it seems that block ...
0
votes
0answers
16 views

Changing the style of a specific block

I need to change the color of a specific block in Drupal. But no matter what I try in CSS it does not work, I know the code is correct as I have tried it in a different scenario (in Codepen) and it ...
0
votes
1answer
40 views

How do I show a block in a region?

All blocks in the footer region use a CSS grid system. I want to add a <div> with CSS attributes to each (custom) block in the footer. The code I have will show the blocks in the footer, but ...
0
votes
0answers
19 views

Access image field URL in a custom block [duplicate]

I need to have an easily exposed to user background image in an aera (header). So i made a custom block with an image field and i want to use this picture in a classical <div style="background.... ...
1
vote
0answers
31 views

Make EntityQuery Block Table sortable

I made a custom EntityQuery Block Plugin with a table output and managed to make the headers sortable using this $header definition: $header = [ 'title' => [ ...
0
votes
1answer
32 views

How to make custom blocks print unsanitized markup

Goal: I like to create a block to display phone no and a link as shown below: Structure > Block layout > custom block > Add custom block, added this: When I go to my site, I see this: How can I ...
2
votes
1answer
57 views

How to create a textfield with autocomplete function for the view?

My Drupal 8 website is multilingual, and on one of the views I present a list of nodes (titles). On top of the page I need to implement a textfield with autocomplete function, where the user can start ...
0
votes
1answer
23 views

Why do my main menu tabs show up on two lines instead of one?

In Drupal 8, I have a main menu in the "Primary menu" block of the default Bartik theme. You can see a screenshot below. This site was upgraded from Drupal 7. Why does the menu show up on two lines ...
0
votes
1answer
11 views

Only the word “array” gets printed when I try to render custom block in template

I am building a custom block in a module, like this: <?php function filterblock_block_info() { // Sökfilter till temperaturöversikten. $blocks = array(); $blocks['filterblock-temperatur'] =...
0
votes
1answer
44 views

How to create entity within blockForm?

I would like for users to be able to create new paragraph entities within the form of a custom block instead of going into the linked content type and adding the content. In the past, I've always ...
0
votes
1answer
48 views

How can I create Change Password block?

We can create reset password block by \Drupal::formBuilder()->getForm('Drupal\user\Form\UserPasswordForm') in d8, but change password block \Drupal::formBuilder()->getForm('Drupal\user\Form\...
0
votes
0answers
35 views

Views block doesn't show up at the user profile page

I created a views block and try to make it appear on the user profile page. I did the following steps, but it doesn't show up: Block layout -> Place block Tab Pages: Select "Show for the listed pages ...