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
16 views

Attachement pager probleme

I created a view with a block that displays articles of a content type. Then I added an attachment that picks 4 articles randomly to show on the left side. The problem is when I scroll down on block ...
1
vote
1answer
14 views

How to modify the D7 user login page html to remove the register and new password options for non-admins?

So, I'm maintaining a Drupal 7 site for which we recently switched the users over to SSO through a third-party OAuth provider. The implementation isn't fancy, but added a login link to what I assume ...
-2
votes
0answers
18 views

How do I automatically add a php code field at the end of a content type whenever new content is created [on hold]

I want to allow the users to add content but every time they create a new content page, I want to automatically add a field at the end. for example: when a user presses add content, this comes up: ...
0
votes
0answers
18 views

Default CSS classes for custom block

I've defined a custom block (Drupal 8) and I'm able to specify defaults for block label and my other custom fields but can't figure out how to hook into the 'CSS class(es)' field for defaults that ...
0
votes
1answer
32 views

How do I pass multiple block configurations to a behavior?

I am trying to create a Drupal 8 module that implements a Curator IO widget, so I created a block plugin with its own custom configuration. public function blockForm($form, FormStateInterface $...
0
votes
1answer
13 views

how to have a different page from the front page?

In my site (psa.modares.ac.ir) all my pages are the same as the front page. for example, I have our team block and price table on the front page but I also see them in blog posts or article pages. why ...
-2
votes
0answers
14 views

Non active links after page reload [closed]

I have a problem with the Football module. When I click on one of teams name and, after that I click, on the t-winner.com logo to go back to the front page, the block with the country names becomes ...
0
votes
0answers
18 views

Webform block not display

In D8, In Block Layout, Place Block of webform of webform form, but when we see output display empty. Inspect element display span tag data-big-pipe-placeholder-id="callback=Drupal%5Cblock%...
0
votes
1answer
13 views

Resizing a block on a drupal 7 website

I have three blocks A, B and C on the home page on location Content Bottom. I have another block D I want to place at location A+B and I want to keep C at the same location. I will move A and B to ...
0
votes
0answers
41 views

Block not showing in controller generated tables Drupal 8

I have created a custom module that should show my custom block above the controller generated table. The block shows in other pages but not in the page where it is supposed to show. Found out that it ...
0
votes
1answer
26 views

Block not showing input fields

I have a block as part of my custom module, I was it to show 2 text boxes (Input & Output) and have a generate button. I cant get it to show the input boxes! It seems they are being stripped out ...
0
votes
1answer
25 views

Place a custom block inside admin area

How is it possible to place a custom block inside the admin area? (e.g. in a node edit form)? I tried with page restriction but with no success. How can I see the block regions of the admin theme (...
0
votes
1answer
23 views

BlockContent::load for addtoany_block returns null

I am trying to load the "AddToAny Buttons" block of AddToAny module inside a controller. My idea is to render the block content as a part of the page. I have verified the block id of "AddToAny Buttons"...
-2
votes
0answers
15 views

Show Simplenews block only to unsubscribed users drupal 8 [closed]

how to show the Simplenews block only to unsubscribed users in drupal 8.
0
votes
0answers
14 views

WebDriverTestBase can't place/see block configuration in an AJAX text

I am writing a functional test that checks the output of a page when a user has a specific cookie. Based on that cookie, I have a block powered by Ajax Block that injects block content personalized ...
0
votes
1answer
71 views

Load a block contents dynamically / via AJAX?

I need to have a custom block on the page (will be sitewide) that has two states - one for when a cookie is present and has a certain value, and the other for when that cookie is not there or the ...
2
votes
1answer
37 views

Is accessing the current node from multiple block plugins on a single page costly from a performance perspective?

I use a combination of Block plugins and panels to populate the layouts of the display modes of various content types. Here's an example: class MyBlockPlugin extends BlockBase { /** * {@...
0
votes
0answers
10 views

block-header.tpl.php just print only one block

I create block-header.tpl.php file just <?php print $block->content; but it only show one block in drupal 6. In drupal 6 header block have 2 blocks.
0
votes
0answers
21 views

Issues removing a Block from content

I'm working on an old D7 site and have been asked to remove a Block from a particular page. First thing I tried was to go to the page in question, click the gear icon next to the block and select ...
0
votes
0answers
36 views

Views paragraph fields in block Twig template

I understand that I can use content['#view'].field['field_name'].value(rowcount) to get a value of a field. But how can I refer to fields of a paragraph field, that is in a view block in a file like "...
0
votes
1answer
55 views

DrupalSettings are not passing the values from block to js?

I have been trying to pass the variables from block to jquery. In Block.php, return [ '#theme' => 'block--exampleblock', '#value' => 'test', '#attached' => [ '...
0
votes
0answers
40 views

Display block when boolean field is checked

I currently have a custom block (created programmatically) thats displays on my news content type (via Layout builder). The code I used for block is below. class NewsButton extends BlockBase { /**...
0
votes
0answers
18 views

Getting a book tree/menu programatically

Given a node ID, how do I display the outline of the book it belongs to? I'm dispatching the pages of the book from a custom, variable, route (and not the alias of the node) so the default book ...
2
votes
1answer
58 views

Have followed instructions to disable cache for development but it's still caching

I have followed all the instructions here https://www.drupal.org/node/2598914 I'm developing a module with a block, and when I went to the Block Layout page and clicked "Place Block", the list of ...
1
vote
1answer
31 views

Remove Log in or Register to post comments

For some reason any time a new post is made at the top of the post a module shows up saying Log In or Register to post comments The problem is that it shows up way at the top of the post, instead of ...
-4
votes
1answer
34 views

Block with Listing of custom links to redirect to pages

With Drupal 8 I want to have a block with a select list that I get programmatically from taxonomy terms and when the user clicks on Submit it redirects the user to the page I put in the list. What is ...
2
votes
1answer
40 views

How do I return a Twig template inside the build method of a block class?

Am new to Drupal and this week I learned quite a bit about module development, and for today the case is: For my new module, I create a custom block that renders a markup, and from the folder ...
0
votes
2answers
40 views

How can I create two blocks at once from the same custom module?

I have figured out how to create a block from a custom module, by creating a ./src/Plugin/Block folder, then creating a PHP script inside it, with the following code: <?php namespace Drupal\...
0
votes
1answer
13 views

Drupal 8 block css add

I am using a fresh D8 install. I have created a custom block with a token which I have added to a header. The block is themes from somewhere to float left. If I, through "inspect" in the browser, add ...
0
votes
1answer
14 views

Setup a view to show most recent post or a post promoted to front page

I setup a view that displays published articles from a specific content type. I want to guarantee an article always displays, so I'd like to order the results to show the most recent post. That is ...
0
votes
1answer
23 views

Alternative #markup in a block's build function

Version: Drupal 8.7.x I am adding some canvas element to my page, and it gets ignored by Drupal. I can't even see it in the source page of browser. If I have something like this in my code: public ...
0
votes
1answer
23 views

How do I get the menu block choice “Expand all menu items” to stay checked

I have 2x menu blocks. One in the header and one in the footer. I'd like the header one to stay unexpanded, but expand all the items in the footer. When I check "Expand all menu items" in the footer,...
0
votes
1answer
30 views

Removing entity queue entries from a view

I have a list of 100 projects. I have set 10 projects as featured projects using Entity Queue module. I have a projects page that shows has two views: First view: 10 projects from entity queue ...
0
votes
2answers
20 views

Hide a list of blocks from Panelizer in-place editor (IPE)

I have a list of blocks that shouldn't be added via panelizer IPE popup under manage content. Is there any way to remove them from the list?
0
votes
1answer
29 views

Inject a theme setting form into a block

Is there a way to inject the theme settings form into a block so it could fix to the left-hand side of the page when admin logins? The url that would be injected into the block would be admin/...
0
votes
0answers
63 views

Call to a member function access() on null in …BlockAccessControlHandler.php

I am getting two errors on my local Drupal 8 site. First error: "The website encountered an unexpected error. Please try again later." Second error: "Fatal error: Call to a member function access() ...
0
votes
1answer
46 views

Fatal error: Declaration of … must be compatible with [closed]

/** * {@inheritdoc} */ public function blockForm($form, FormStateInterface $form_state) { return []; } in BlockBase.php vs /** * @inheritdoc */ public function ...
-4
votes
1answer
26 views

node access permission [closed]

i have created a custom block where i retrieve few fields value from a content of specific content-type(called project)and display it as a card in the site. but i don't want users who have logged into ...
0
votes
1answer
38 views

Add separate div after a form

All I want to do is add a new <div>, ideally just after a <form> element. I have a self-written module that generates a payment form, using some routing, like this: mymodule.applications....
0
votes
0answers
53 views

Export blocks added via layout builder as default content

I am using Layout Builder to add blocks into my nodes. I am adding several instances of different custom block types to specific content individually. I wander if it is it possible to export those ...
1
vote
1answer
95 views

Get block id in block theme template

I'd like to be able to print the block id/number of my custom block in its template. I feel like these must exist because Display Suite has a token for it: [block_content:id]. Like a url to edit a ...
0
votes
1answer
23 views

Use Display Suite token field in custom block type template

I have a custom block type, which uses its own theme template. I have a display suite token field link_card_edit_block It just uses HTML and tokens to create a link. I want to use that field in my ...
0
votes
0answers
11 views

What is the right approach to create a block in a bootstrap theme?

I have a non-Drupal bootstrap 3 theme. I like one of its sections, which I would like to use in my drupal bootstrap theme. I am little confused how I should do it. One simple way is to create a block ...
0
votes
1answer
45 views

Adding a view block to a basic page

I have been tasked with creating a new basic page that contains displays, the content of some new content type. So far, I have created the basic page and I have also created a new view block (i.e. I ...
0
votes
0answers
22 views

Creating block of category 'commerce' to show shopping cart contents

I am new to drupal, and am trying to create a commerce page. I have created a basic page, and I am now trying to add a block which lists the products in the shopping cart. I am using an existing ...
0
votes
1answer
45 views

How to Make Managed File Field Available to Twig Template?

I am wanting to make it so that users can upload images to a block configuration form for a pre-existing (views-generated) block (views_exposed_form) and have the images available in the block's ...
1
vote
1answer
34 views

Duplicating content blocks

Is there a way to clone or make copies of blocks? For example, we have some blocks that are quite bespoke. We need to make multiple copies of them so we can display certain content within them on ...
0
votes
0answers
31 views

Save value in form with multiple instances in same page

This is my buildForm function: class NewsletterForm extends FormBase { // ... public function buildForm(array $form, FormStateInterface $form_state, $newsletter_list = NULL) { $form_state->...
0
votes
1answer
45 views

How do I identify what type of data or object I have? It's a referenced entity

I am new to Drupal but an experienced developer. I'm creating a DS field in which I will display a custom block chosen by the content editor. I have successfully gotten a referenced entity (two ...
0
votes
0answers
16 views

Ajax loader when facet is selected

When we add a facet block to the page, a filter is selected and the page starts to load the results. However there is no loading icon or indicator the change is being applied. When we check the page,...