Blocks are self-contained collections of content and functionality that are displayed within theme regions.

learn more… | top users | synonyms

0
votes
1answer
12 views

How can I display seveal menus with different classes

I have the "joy" to upgrade a Drupal 6 site to Durpal 8. In my Drupal 8 site I have three different menus, which each display different types of nodes. I want to display them in the region of the ...
0
votes
0answers
18 views

Placing block from a module not working

I've followed the tutorial to create a custom block from https://www.drupal.org/node/2101565 My module installed fine and I can see the block in the list of available Blocks for placing, but as soon ...
1
vote
1answer
19 views

Restrict menu item to certain roles in TB Mega Menu

I am currently using TB Mega Menu on D7 to configure my main menu. One of the main menu item is accessible to both anon & authenticated users.I would like to have a block attached to this item as ...
4
votes
0answers
49 views

Create dynamic block instances

In Drupal 7, if we need to define multiple instances of blocks from a database table, we use a foreach loop to return the array key, and then we we get all the multiple instances of our block using ...
1
vote
1answer
31 views

How do I list all blocks with PHP enabled inside?

I added a custom block that uses PHP, and now I get the following notice message: Trying to get property of non-object in eval() (line 5 of /public_html/modules/php/php.module(80) : eval()'d ...
0
votes
1answer
22 views

override MenuLinkTree Block

I want to override the block menu behavior, but i don't know how to do that, because the menu block are created dynamically. I know add some block with the block plugin, like this : /** * * ...
0
votes
1answer
19 views

How To: Change Block Text Color

I need to change the text color of a block on my main page. The existing theme uses blue text on a light blue background which makes it somewhat difficult to read. I used Firebug to find the div ID ...
0
votes
2answers
38 views

How i could save a block that i had called it before with block_load?

I call a block via a block_load function and i do some changes. What i want to save this block with my changes..
1
vote
0answers
11 views

Create text search block on home page leading to faceted search view?

This seems like an easy question that seems still unanswered. I have a faceted search in Views. Works nicely. All I want to do is: Create a text field search in a block (can be anywhere, can just ...
0
votes
2answers
46 views

Is there any way to adjust the items per block options?

In Drupal 8, whenever you create a view block, you have the option to specify the number of items displayed in that view block which is awesome. Currently, you can choose between 1, 5, 10, and 20. Is ...
0
votes
1answer
7 views

Field as Block column not showing

I installed the Field as Block plugin without problems, but when I go to Structure > Content Types > Basic Page > Manage Display, I still don't see the "Display as block" checkbox. I tried googling ...
0
votes
0answers
13 views

Possible to load block view as popup

I currently have a content type to add locations to the leaflet map and a view for the map itself that shows all locations added. I also have another view that grabs that location data and it ...
0
votes
0answers
25 views

How do i set '#cache' attribute value in a renderable array in drupal 8?

I need to render an image from my custom block. So i have to return an renderable array of an image object from my block. I have written code like this(snippet), and its working fine. $logo_build = ...
3
votes
1answer
29 views

How to clear or rebuild a cached block for a specific user?

I have a block with the cache setting DRUPAL_CACHE_PER_USER. I want to clear the cache when a user performs a specific action. I want to clear the cached block only for the acting user, keeping the ...
0
votes
2answers
44 views

Drupal 8 - Custom Module to show and store user email in DB

I'm currently learning myself Drupal module development. I finished a tutorial for showing "Hello World!" in a block. And now I'm trying to show the logged in user's email and make a button to save it ...
3
votes
3answers
35 views

Can I add a field collection to a block?

I have made a field collection, exported as a Feature and now I'd like to add it to a block. Does anyone have any suggestions? I have added fields to blocks through the form API, but that doesn't ...
1
vote
1answer
24 views

How do I return a number in render arrays?

I am building a module in Drupal 8. I am doing a query in database and I return the number of users and the number of nodes. I write of screen this numbers without errors, but I cannot write them in a ...
1
vote
1answer
18 views

Clear block cache in panels page

I'm having trouble with refreshing content in a block created with a custom module, placed within a panels page. My end goal is to display either regular or seasonal hours based on a set date range. ...
1
vote
1answer
29 views

How to create a dynamic menu block system with 3-tier system?

I want to create a complex menu system as described in the following image: It looks complex but logically it is simple. I want to create a block containing Menu items. Brief description of image ...
0
votes
1answer
20 views

drupal 8.1 blocks config choices different from D8

I did a migration in Nov/2015 of my D6 to D8 and the blocks look like this. Then I repeated the migration of my D6 to D8 on May/2016 and my blocks look like this. They are different. ...
0
votes
0answers
15 views

Drupal views block Not displaying

I have a views block that displays information in the view BUT when I select the block to display in a region the block does not show. This does not happens to other views blocks. I can go to the ...
0
votes
0answers
12 views

Block content type not showing up on homepage

I created a banner image I want to place on the homepage, I chose to place it in a block content type. Everything is linked and saved correctly, but when I go back to the homepage the block isn't ...
0
votes
1answer
40 views

Showing form data in a block [duplicate]

I have a multi step custom made form in Drupal 8.2.x. Some of the user input from the form needs to be shown on a separate block. The following code worked fine for users that are logged in: ...
0
votes
0answers
39 views

Problem extending BookNavigationBlock

i have a Problem extending a BookNavigationBlock Plugin. When I extend BlockBase it works, but when trying to extend BookNavigationBlock, it fails when placing the block, without any error messages. ...
0
votes
1answer
44 views

How should I go about placing the content of a field from a content type into a block?

My case is this: I have a content type called 'Test Type' with 2 fields: Body (text area), Slideshow (Unlimited list of images) When I create an instance of Test Type and it renders, my goal would be ...
0
votes
1answer
35 views

Creating custom blocks [closed]

I am building a custom block. The content of module_name/src/Plugin/Block/MyCustomblockName.php is the following. namespace Drupal\module_name\Plugin\Block; use Drupal\block\BlockBase; ...
1
vote
2answers
21 views

Edit weight of block without using drag and drop

I'm attempting to reorder blocks. I understand that it can be done by dragging and dropping on the block structure page, however I have a limitation. When saving, the order isn't saved. This is most ...
1
vote
1answer
13 views

Accessing custom block fields from a template file

I have a sidebar region "Sidebar Ad" and placed in that region is the custom block "Sidebar Ad" of type "Image" which has two fields "Image" and "Link". When I output the block on my page using {{ ...
1
vote
2answers
25 views

How to promote nodes/pages into blocks?

Standard Drupal comes with a "promote to front page" when creating new content. But I want know how to promote, let's say News flow to the block located to the right? As far as I know there is no ...
1
vote
2answers
24 views

Overwrite a block template

I want to render a template from a custom block. When I check the source with Twig debug enabled, I see the following output. <!-- THEME DEBUG --> <!-- THEME HOOK: 'block' --> <!-- ...
0
votes
1answer
8 views

Custom theme block position is not importing

Problem: Making a custom theme with blocks placed in different regions. Place custom blocks in theme using the UI. Export config. drush cex vcs When it came time to import my config in a new ...
1
vote
2answers
57 views

How can I insert block content between page fields?

My page content type has two entity reference types that reference other content types. Hero Quotes The hero displays at the top of the page and I want the Quotes at the bottom of the page. In ...
0
votes
0answers
10 views

Disable Cache for a specific block [duplicate]

I'm working on new website with Drupal 8 my site is now on production. I have a block of type php that read data from an xml file. I activated both cache (Internal and Dynamic) ,so every time i change ...
0
votes
0answers
11 views

D8 - Block Visibility Settings are missing, no contextual links for block, and how to use block attributes or block class module

I have installed drupal 8, I have used bootstrap theme and created a sub theme but I am having issues with blocks, I have created a custom block and i am not able to see the visibility settings for ...
0
votes
1answer
33 views

Drupal 8 Primary admin actions block on view dissapears if change path

There is a "primary admin actions" block in the seven theme (provided by the Drupal 8 standard install profile) which only shows up if my view if the path is "admin/content" but if I change the path ...
1
vote
1answer
63 views

Why is this block found but not installed?

I have a custom block that is found by "Place Block" but does not actually get placed. The spinny just spins for second and then nothing happens; the screen just stays at the list of available blocks. ...
0
votes
1answer
33 views

Programmatically added block does't appears in block admin page

I created a programmatically block in a custom module for Drupal 8.1. The custom module and the block plugin are created via Drupal Console. I installed my module and I clear cache via drush cr, but ...
0
votes
1answer
38 views

How to print the node body in a custom block?

I am trying to print the node body in a custom block, but it's not showing up. I'm I doing this correctly? $refer = $_SERVER[HTTP_REFERER]; $parsed = parse_url($refer); $alias = array_pop($parsed); ...
0
votes
0answers
14 views

How to create a View block for list of node title created and node title commented by logged in User?

I want to create a View block for the logged in user which shown list of node he has created and list of node he has commented, only titles of both. Just wrote point-wise below for better ...
0
votes
2answers
30 views

hook_block visibility

I have a custom module defining a block which needs some complex page visibility rules that I'll write later. In building out the basic hook_block code the visibility and pages settings don't seem to ...
0
votes
1answer
23 views

Export block content in drupal 8

I have made my custom block content. I created a block with it and I assigned it to a region. How can I export the actual block content not the block type?
1
vote
2answers
19 views

Using blocks in multiple regions

In one demo projects I have found that I need to place same block in two different regions. I have the knowledge that one block can be placed to one region only. Can anyone help me with this ?
6
votes
4answers
219 views

How do I correctly setup caching for my custom block showing content depending on the current node?

I have this very basic block which just shows the current node's ID. <?php /** * @file * Contains \Drupal\mymodule\Plugin\Block\ExampleEmptyBlock. */ namespace Drupal\mymodule\Plugin\Block; ...
5
votes
4answers
191 views

What's the best practice to show a node's fields in different regions?

In D7 we used to create a view for nodes, with each field having an own display. Each display creates a block to place in any region of the site. But of course, Views are SQL-heavy. Now, Drupal 8 is ...
0
votes
1answer
23 views

Iframe in a block

I am trying to embed a google map(iframe code) in drupal block. But the map doesnt show up.I have have just copy pasted iframe in drupal block with full html as format but the map doesnt show up.But ...
0
votes
1answer
43 views

Getting views contextual filter from url for display suite block

I have a URL for an event content type that concatenates two other content types, namely "name-of-venue" and "name-of-performer" with "date-of-event", so the url is ...
0
votes
1answer
30 views

Where is the code of a new view i've created?

i'm using drupal 7 with starter theme of zen. i've created a view on a block, now i need to customize some parts of html / css in order to add just media query (css part) and add a <a> tag with ...
0
votes
1answer
14 views

Custom block created with GUI stripping some <a> tags, not all of them

I am creating a custom block in D8; the block includes the following HTML: <div class="header__action-items"> <a class="btn btn-large" href="help">Donate Now</a> <a ...
0
votes
1answer
32 views

Add content links for Organic Groups

I'm using OG and OG Extra to make some kind of community website.. but unfortunately I don't see the group content block even when I added it to a region. . Please what could be the solution for that ...
3
votes
1answer
28 views

Supressing “Undefined variable: variables in module_block_view()” without hiding the notice

I tried to create a simple custom block inside a custom module. there is a notice that inform me about undefined variable, but the block rendered properly. I am not sure where the mistake in the code ...