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

learn more… | top users | synonyms

0
votes
0answers
20 views

Drupal 8 site migrated from Drupal 7 shows themeless and blockless front page

I've installed a brand new Drupal 8 site (http://checkwmiplus.edcint.co.nz) with next to no configuration, default theme etc. I then ran Drupal Update against a Drupal 7 site ...
1
vote
1answer
21 views

Centering block view [on hold]

Hello Drupal community! I have a questions about displaying content with views. Is it possible to center the content within the block, in-browser? Right now I have two entities next to each other, ...
1
vote
1answer
10 views

Drupal 7 Event Calendar View Block Output Configuration

I have installed the event calendar module. The problem that I have is that the calendar block outputs as follows: S M T W T F S where I would like it to be outputted as follows: M T W T F ...
0
votes
1answer
13 views

Can't access links in block_view_alter hook

I have a two-language site with the standard language switcher block. I want to remove the link that points to the current page language (I only want the user to see one link to switch to the language ...
0
votes
0answers
17 views

Add additional div to title_suffix in Block

I've tried to add some additional tags into block title_suffix attributes using template_preprocess_block(). Unfortunately i can't make it work as i expected in Drupal8. This is the code i used: ...
0
votes
0answers
46 views

Change custom block content based on URL parameter

I'm trying to accomplish a certain task and clueless. Im using Drupal 8 for my new project.I have a slideshow in my home page and I've used 'flexslider' plugin and views for achieving this. This is ...
0
votes
2answers
52 views

Customize user login block

I've been playing around with Drupal 8 since about a week. A couple days ago I tried to design the user login page to my needs but I couldn't quite do it. My problem is the following: I want to ...
1
vote
2answers
32 views

Passing current node ID to the block template

I have a module with a custom block MyCustomBlock.php that get the nid of the current page and pass the value to the block template: $node = \Drupal::routeMatch()->getParameter('node'); $nid = ...
0
votes
2answers
43 views

Twig dump not working (PHP Warning: Leaked 2 hashtable iterators )

I'm trying to create a custom markup for a views-block. What I want to do is similar to what someone is trying to do here (How to create a custom markup for a views-block?). My view-block has 3 ...
0
votes
0answers
19 views

Clicking on Place a Block in Drupal 8 Block Layout Page gives ajax error

Uncaught AjaxError: An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /admin/structure/block/library/jethrosub?region=sidebar_first StatusText: Internal Server ...
0
votes
0answers
22 views

How do I create a custom block on a user profile page that displays external content? [duplicate]

I'd like to create custom module that provides a block to be displayed on a user's profile page. It needs to grab content from a rest api using data from a user's Profile 2 fields. How do I get the ...
0
votes
1answer
20 views

Generate a cookie when user closes a webform block

I have been tasked with having to setup a cookie that records when an anonymous user closes a newsletter signup webform block so that it no longer appears when reloading the current page or navigating ...
0
votes
0answers
31 views

Reuse Block's visibility settings mechanism for custom entity

I'm on Drupal 8. I'm writing a module where I want to have custom entity which will reuse Block's visibility mechanism. I don't want custom block type, I don't want my custom entities to appear as ...
0
votes
2answers
30 views

Custom Block Can't Invalid the Cache

I wrote a block in Drupal 8 to render a menu based on the http headers of the request, which contains the users' information from the idp. This menu is supposed to be different from user to user, but ...
0
votes
1answer
26 views

Drupal 8 - get views machine name in block--views-block-html.twig file

I've create views as block. Then i tried to theme my views block by altering block--views-block-html.twig file. I've struggled to get views machine name in this file. I need views machine name for ...
0
votes
0answers
9 views

One Content type multiple usages of that content type, reusable background field?

As the title says. I have ran into a weird issue. I need to find a way to reuse my content type but allow myself to edit the background of that content type. So eventually i would have a lot of ...
0
votes
1answer
31 views

How do I programatically create and display a one-off view?

I am programmatically generating views based on an entity with varying fields and saving them with $view->save(). Just to be clear, I have to do this because my entities have x-amount of fields, ...
0
votes
0answers
15 views

Is there a way to change content in one master node and have it changed in hundreds of others

I have searched for quite a while but with no success. Using D7.41, Views 3. I have a buch of nodes of the same content type (~50 nodes) and all of these nodes have images and some text, plus 4-6 ...
0
votes
1answer
28 views

Add a class to all the blocks in a region

I'm theming a Drupal 7 site and I'd like to add a class to all the blocks in a given region using preprocess_block(). I think this should work, but it doesn't seem to: function ...
1
vote
1answer
108 views

How do I include the main navigation block twice?

How can I put one block, for example the main navigation block, in two different regions. In Drupal 7 this was possible through the Menu Block module, but as this module won't be ported to Drupal 8, I ...
1
vote
2answers
80 views

Change position of a block in particular page

I have a Drupal's default User Login block in Side bar first region at the last position. Reference page: http://indiansnakes.org/snakes The proposed home page has been redesigned and the User Login ...
0
votes
2answers
32 views

How to remove unwanted div from view rendered block?

In D8 I've created a view and assigned it into a block, I've created corresponding template for both view and block. Most of the unwanted addition of div's and classes has been removed. But the ...
0
votes
0answers
32 views

Use NID in contextual filter on front page

I have a view set up that creates a block with some fields from a node. It uses the NID as a contextual filter so that the block shows the correct node's fields. This works fine on the individual node ...
3
votes
3answers
105 views

Can I include nodes in a view's results only at URLs specified in the nodes?

Is it possible to conditionally include nodes in a view based on the paths specified in a field on that node? The idea is to essentially mimic the default property of blocks, making their display ...
0
votes
1answer
14 views

How to display menu block but deny adding a new instance?

I have a menu which has a block provided by the system automatically. This menu has links that come from a module which defines the menu(config). This menu block can be seen(ie. the block is visible) ...
3
votes
1answer
64 views

How do I make variables available for all blocks in a page?

In my website I have an inc file containing some values that are needed on all blocks of a page. For reasons related to the performances, I would like not to use the php "require" function in each ...
1
vote
1answer
44 views

Block Regions in node.html.twig

How can i use block regions in my node.html.twig in drupal 8 ? i tried this : block_get_blocks_by_region but function not found
0
votes
3answers
34 views

Alter list of blocks on admin page

I'm using Drupal 8. I need to hide blocks of certain type from blocks UI because I'm managing them from my custom module and I'm not using them as a regular blocks. Is there any way of altering ...
0
votes
0answers
12 views

Display regions in user-profile.tpl.php

I created a region into mytheme.info regions[list_user_poke] = List User Poke I put a block in it. Then I want to print this region user-profile.tpl.php. I wrote this chode : <div ...
0
votes
1answer
29 views

Custom Form Block not displaying

I'm trying to create a custom form displayed inside of a block. [edited] <?php function edit_node_block_info(){ $blocks['edit_node'] = array( 'info' => t('Custom Block to allow ...
0
votes
1answer
38 views

Is there any way to restore deleted core block in Drupal 8?

How to restore core/menu or other programmatically created blocks if they have been deleted in D8? I remember in D6 and D7 was no possibility to delete programmatically created blocks. But D8 allows ...
1
vote
1answer
14 views

How to place blocks in code with zen theme?

I've been tasked with maintaining a site I didn't make and I don't have access to the original developers. The site is built with a custom zen theme. The block that I'm interested in is listed in the ...
0
votes
1answer
38 views

How to capture value of a field in a node

I am nearly a complete newbie when it comes to writing modules (Drupal 7). I have a module that successfully calls an OpenStates API and retrieves information about a member of the legislature. The ...
1
vote
1answer
23 views

Book navigation block?

Where is the book navigation block in Drupal 8? The structure guide for Drupal 7 says you just need to turn the navigation menu on by enabling the block. ...One navigational aid you can use is ...
0
votes
0answers
11 views

What is the purpose of the 'custom' column on the 'blocks' table?

I am programatically creating a block using code like : $form_state['values'] = array( 'title' => $node->title, 'info' => 'Discussion point - ' . $node->title . ' [nid=' ...
0
votes
2answers
46 views

Custom block assigned to new region invalid

I had created a new region to my theme "buynow" and my theme.info contains the following line regions[buynow] = Buynow In my custom module i had created a custom block in which i assigned the block ...
1
vote
0answers
25 views

Include SVG in a block markup

I'm building a custom markup for a block but the SVG part is not rendered. Everything else is rendered correctly. class HomeSocial extends BlockBase { /** * {@inheritdoc} */ public ...
0
votes
1answer
14 views

Display region's blocks into user-profile.tpl.php

I created a view listing content type called stories. Then I created a block with this view. In mytheme.info file I have this code : regions[header] = Header regions[story] = Story regions[content] ...
0
votes
0answers
18 views

Displaying nodes from parent terms of user

I have a taxonomy with an organization of departments. Organisation: Dept1 Subdept1 Subdept2 Dept2 Subdept3 Subdept4 I have created a entity reference field, I use the same field with both ...
0
votes
0answers
14 views

Theming inside blocks

I don't know the process to theme inside regions in Drupal 8. I have the knowledge to theme regions by putting {{ page.XXX }} in the twig file (with regions declaration in the YML file) .But for ...
0
votes
1answer
43 views

Check if block is visible

I'm on Drupal 8, I'm using \Drupal::entityQuery('block') to get the list of blocks. Now I want to determine if the block is visible for: Current Page (Content Type) Current User (Role) Current ...
0
votes
1answer
28 views

Include content on module install of a custom block

I'm using Features for creating a custom module that installs and places blocks on my site, but Features doesn't export content and in this case the block contents will be needed. I'm trying figure ...
1
vote
0answers
28 views

Views generating a new slideshow for every picture

I am using juicebox with Views module and everytime a user uploads a new picture, the view I created keeps generating another slideshow to the page. I just want the new uploaded picture to be added ...
0
votes
0answers
26 views

Is there way to export block layout settings?

I created a custom theme and I was wondering if there is way to export my block layout settings (location and order of each block). This way will be easier to apply my theme in a different site. I'm ...
1
vote
0answers
21 views

Translate a block configuration's form

How can i translate a block configuration's form made programmatically ? I'm using I18n for translations and here's the code of the block : function MY_MODULE_block_configure($delta='') { $form = ...
0
votes
0answers
25 views

New page controlled by Archive block

been searching around, but I must be missing something. I have a panel page that load two views. Each view have a list of different article type. the panel is loaded in the main content region of the ...
0
votes
1answer
26 views

Block expands more than the height of content when using collapsiblock module?

I have applied the collapsible property to one of the block using Collapsiblock in Drupal 7. everything working fine, but the issue is that, after clicking for slide, it slides more than the content ...
-1
votes
2answers
42 views

Twig C module not enabled causing issues with blocks?

I installed Drupal 8 on shared hosting and am having a problem in which blocks are not visible after I've placed them in a region. The blocks that came preinstalled with the themes are visible, but ...
0
votes
1answer
20 views

Wysiwyg in views module

Can I add a wysiwyg field in Views so that users can write and post text on my page? Would I need to enable this as a block? I have installed ckeditor and views already.
0
votes
3answers
31 views

Render a button in a block

I want to display a button on the homepage. The best solution i've thought about was to render it in a block. The code is the following : $button['my_tickets'] =array( '#type' => ...