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

learn more… | top users | synonyms

0
votes
1answer
22 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
23 views

Creating custom blocks [on hold]

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
1answer
13 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
12 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
22 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
15 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
7 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 ...
0
votes
2answers
35 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
8 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
19 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
58 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
30 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
31 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
29 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
21 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
16 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 ?
4
votes
4answers
185 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; ...
2
votes
3answers
74 views
+100

Whats best practice to show a node's fields in different regions in Drupal 8?

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
40 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
29 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
26 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 ...
1
vote
1answer
17 views

SQLSTATE[42000]: Syntax error or access violation in drupal views query [closed]

When trying to preview a view containing references to three Field Collection module fields, I get the following error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in ...
0
votes
1answer
25 views

Drupal 8 strict HTML strips CSS classes in Custom Block

I created a Custom Block used Strict HTML (and added etc to allowed HTML). If I look at the frontend is strips all the CSS classes like <div class="myclass"> What do I have to do to create ...
0
votes
1answer
15 views

Configuration management export blocks from Dev to Staging

I created and placed some blocks in my local Drupal 8 Dev site. I exported the full configuration. After I import the configuration into my Staging site I get this error: This block is broken or ...
0
votes
1answer
20 views

Seemingly random <h3> being added into views node header for content type

I've got what seem to be random empty <h3>s appearing whilst displaying a custom content type as a teaser in a pretty standard blocks display through Views. Now this is only a problem because ...
0
votes
0answers
12 views

Get all referencing entities two levels upstream

I have three content types. Content Type A, Content Type B and Content Type C. Content Type A has an Entity Reference field named field_B Content Type B has an Entity Reference field named field_C ...
0
votes
3answers
27 views

How to configure the default visibility to “Only the listed pages” when adding a block?

When adding a block to the site: Home » Administration » Structure » Blocks the default setting for visibility is set to "All pages except those listed." is there a way to set the default setting ...
3
votes
1answer
25 views

'A' tags in Custom Blocks get removed

I created a few regions for my footer. Inside of each region I've added a custom block with plain html code. One has the contact info, another has social media icons and the last one has a map. The ...
0
votes
0answers
4 views

want to build custom block with bean and output a form with user editable fields

I'm trying to build a configurable block that accepts an event code(content editor configurable) so that it can be reused across different pages with different event codes. The output of this should ...
0
votes
1answer
36 views

How to specify the numbers of characters for teaser for views block?

I know we can specify the specify limit for the teaser by going to content type -> manage display -> teasers. I have made the views block for teasers and I want to display only few lines for that ...
0
votes
0answers
18 views

Using MEFIBS (More Exposed Forms in Blocks) in Blocks

I know this may sound redundant but It isn't. The MEFIBS module allows to put the exposed filters form of a view in a block, which later you can place wherever you want in the page but also wherever ...
1
vote
2answers
23 views

How to delete blocks and why some you can delete and others you can't?

I'm probably missing something here.... But there is no delete option for blocks, either enabled OR dissabled. Additionally, some blocks can be deleted, and some don't , they have the same exact ...
0
votes
0answers
18 views

How to call webservices from php on drupal 7 [duplicate]

I want to call a php webservices(REST) on my Drupal site. How to do that. And how to display the result in a page/block. Never have worked before with REST and have idea how i can fulfil the process ...
1
vote
0answers
32 views

Hide region when block menu is empty

I got the 2nd level main menu in a block in the sidebar, drupal 8 correctly hides the menu (and the block) when the user browses a page that is not in this menu, but the theme continues to show the ...
0
votes
1answer
35 views

Add PHP code to block's content [closed]

Is there a module that allows a php text filter in drupal 8? This was a possibility in drupal-7 but I can not find something similar to 8.
0
votes
1answer
22 views

Specifying parameters for block_load

UPDATE: Following Shawn Conn's advice I was able to render a specific block changing $res_output = drupal_render($res_output); to $res_output = drupal_render($output); But I'm still unable to ...
-2
votes
0answers
15 views

get slogan site for contents

i have created this module : display nodes with her : title , type, and site name, but i want that display site_name for each node Example : Node 1 : Type1, Site name 1 Node 2 : Type2, Site name ...
0
votes
1answer
34 views

Display Form result in a block

I have created a custom form in Drupal 7 and entered some values then submit the form. I want to display the submitted value in a block. How to do this in drupal 7. I am new to this. This is the code ...
0
votes
0answers
18 views

Blocks only visible to Admin, despite clear permissions

This problem concerns two related content types: Vendors and Resources (which are products sold by the Vendors). I have set up a Views block, "Resources by vendor", to display on all Vendor pages. ...
0
votes
0answers
17 views

Bootstrap blocks - getting positioning and padding right

I am using the bootstrap theme. I am generating pages that contain blocks from views. Getting the layout right is driving me insane. For example, on one page I have one block generated from a view ...
0
votes
3answers
32 views

7 - Add CSS to a LIST items in a block

I'm trying to display a block on a left side bar with few links. I've created a block and it shows up with the links but NO CSS applied: <div class="vertical-tabs"> <ul ...
1
vote
2answers
43 views

Form / Block / Template

I try to theme a custom form in my block. Here my code : boutique.module /** * Implements hook_theme(). */ function boutique_theme() { return array( 'ajout_panier_form'=> ...
2
votes
0answers
17 views

Using the User Referral Module, How do I display referral link within a block using PHP?

I have downloaded the User Referral Module and am trying to display the user's link within a block so I can place it on a specific landing page. The module out of the box doesn't have Views support, ...
2
votes
3answers
128 views

How to grant permissions for translating block content?

I used Block Image module to create some content; now I want to give the site's editor, permission to translate the blocks, but I can't seem to find how I can do that. There's no permission to let a ...
0
votes
1answer
21 views

How to build a reusable configurable form

How could I build a reusable form that can be reconfigured for each location in which it is used? It would have the same fields, however select list values would be different depending on what the ...