Questions tagged [blocks]

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

695 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
627 views

Theming links in blocks using twig templates

I have a block for the language switcher. I want to override the links in it. I can override a specific language switcher block's markup, and I can override the links markup in all language switcher ...
3
votes
1answer
2k views

How do I programmatically remove a block?

I have a custom module that is intended to be deployed as a pure web view, with no styling whatsoever beyond what I created in the .twig file. I installed the Stark theme and in my local instance I ...
3
votes
2answers
567 views

How have multiple instances of a Custom Block?

So I have a custom block that has been created within the module. I have used the drupal API to generate the brand new fields - which works perfectly. However, I am having an issue regarding multiple ...
3
votes
1answer
4k views

Add a link field to block form

I've created a module with a custom block that extends BlockBase. To the block form I added multiple textfields and select boxes, by simply specifying the formatter in the '#type' configuration. My ...
3
votes
0answers
852 views

Get the active menu parent from a menu block

I'm attempting to use hook_block_view_alter() to set a block title to the name of the page's parent menu item. The block is a menu block for the main menu that is showing second-level items. I've ...
3
votes
0answers
296 views

Get Location module Block : how to show map markers for particular taxonomy term - exposed to user

I am using the Get Location module for building store locator functionality in my site. I have made a content type with field = address and field type = Geolocations Fields with widget = Geocoder. I ...
3
votes
1answer
187 views

Block taxonomy list count with filter by search term?

Currently I have setup a view to display custom search results based on search terms (exposed filter): /blog/search?keys=user+entered+term On the page I am looking to show a list of tags with counts ...
3
votes
1answer
453 views

How do you keep the login block on the same page when validation fails?

On pages where the login block exists, I need to stay on that page (and preserve query string arguments) if the validation fails when submitting the form. Does anyone have any idea how this could be ...
3
votes
1answer
2k views

Taxonomy-term based block display

I'm trying to display certain blocks in taxonomy term pages and the nodes associated based on the taxonomy term itself. Let's say I have 3 taxonomy terms: Bologna, Milan and Rome. When I'm in ...
3
votes
2answers
147 views

Per instance settings on blocks with context?

Blocks normally have a single global configuration. What options are there to provide "per instance" settings on blocks, so that I can vary them depending on where they are displayed, when they are ...
3
votes
1answer
94 views

Article view with links to other articles

So I'm trying to create a view which displays the most recent article belonging to a specific taxonomy term and pulls out just the links to other articles which have the same term. I want to display ...
3
votes
1answer
1k views

Menu Block: Expand all children of this tree - ignored?

Is anybody using Taxonomy Menu + Menu Block? I have a problem setting Expand all children of this tree, in that it seems to be completely ignored. My sidebar taxonomy menu lists all children expanded, ...
3
votes
3answers
6k views

Breadcrumb/block settings

Should Views (that are setup as a Page) be able to inherit breadcrumbs/block visibility settings? When I create a Views page, set a path, add it to the menu (then adjust it to be a sub-menu of another ...
3
votes
1answer
444 views

Select an Image style depending on external/dynamic factors (theme region or other field content)

I have a Bean (bundle that generates blocks) which I display in one of 2 different theme regions. Either in the header, or the footer. This Bean contains an Imagefield, which is rendered through an ...
2
votes
0answers
34 views

Any downside when using block_content as custom content entities?

Background: For a tourism project I need to integrate volatile data from external sources (like snow reports for ski ressorts or movies and their showtimes). This data should not be accessible by its ...
2
votes
0answers
182 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:'...
2
votes
0answers
23 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 ...
2
votes
0answers
146 views

How do I add a Hubspot tracking code into a Drupal Website

I followed the instructions for Drupal lower on this page: https://knowledge.hubspot.com/getting-started-with-hubspot-v2/install-the-tracking-code by adding a block and doing exactly what they said ...
2
votes
0answers
138 views

Custom block panelizer settings

Can anyone advice me on how I can include a settings/configuration form for my custom module within Panelizer? I'm working on a custom module which uses an API to display data to a user. The block ...
2
votes
3answers
379 views

Hide a region with empty view in it

I have a region page_intro where I display a view, with some CSS on it. When the view is empty (return no result), the region is still displayed (All html code before and after {{ page.page_intro }}). ...
2
votes
2answers
632 views

How to show a block on a specific url?

I need to show blocks on different url's. Block1 Should be displayed on: branches/taxonomytermlevel1 But not on branches/taxonomytermlevel1/taxonomytermlevel2 Block2 Should be displayed on ...
2
votes
0answers
101 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
0answers
1k views

How to render a facet block?

I've created a facet block according to this example Programatically render a block in a twig template I've created the facet block as follows: $variables['block_output'] = Drupal::service('plugin....
2
votes
0answers
121 views

How to build ajax “Add More” form bean?

I had build plugin type Bean which used ajax load more form . But this not working ? How to fix or change my code . This file Class extends BeanPlugin class IconLinkSocial extends BeanPlugin { ...
2
votes
3answers
712 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 ...
2
votes
1answer
39 views

Drupal 7 - views blocks not displaying page field content

I have a page where a view is creating a block which loads a field. Other blocks loaded into the region are showing up just fine but that particular one will not show. It is not because the field is ...
2
votes
1answer
140 views

How to show user info in DIV based on link click?

I'm currently trying to make a 'biography' block with Drupal profile pictures and when you click on them more information (user fields that has been filled in by the Drupal user) will dynamically ...
2
votes
1answer
118 views

Redirecting doesn't work with a custom form in a block

I developed a custom form with FAPI and added a block for it. Block is included only on one specific page (basic node). When user submits this form it should redirect user to external site (URL is a ...
2
votes
0answers
31 views

Programatic block with default configuration form?

We're using features on our Drupal project. We would like to specify few blocks NEED to be present in the database and their settings. Imagine block named "sidebar advertisement". That block has ...
2
votes
2answers
224 views

placing a menu block inside a views template

I need to place a menu block (the main-menu) inside a views template file - the template for the rows design. I tried $block = module_invoke('system','main_menu'); print render($block['content']); ...
2
votes
0answers
113 views

Using content field widget in custom block?

I'm trying to figure out an easy way to implement a content field type (image_field) with a widget (imagefield_crop) on a custom block. The block currently has an upload image feature, but I want to ...
2
votes
1answer
119 views

Show User Information in Block from View

I have a block that shows some data from the User area (People) in Drupal 7. I have a rewrite setup that shows "VACANT" if there is no user selected for the content type. When logged in, I see users ...
2
votes
1answer
346 views

I can't get the og_group_ref set in a node form rendered via a custom block

My block code is as follows: mymodule_block_info() { $blocks = array(); $blocks['my_contenttype_form_block'] = array( 'info' => t('My CustomContentType Add Form'), 'cache' => ...
2
votes
2answers
70 views

How to display a block for some paths but not if they match some other path also?

Let's say I have nodes with the following paths: /chapters/university-of-florida/classrooms/class1 /chapters/university-of-chicago/classrooms/class2 /chapters/ucla/classrooms/cla I'd like to display ...
2
votes
0answers
268 views

Block missing from admin

I was wondering if anyone has been able to successfully resolve the issue of the missing custom blocks from the admin list in drupal yet? I have been struggling with this problem for 2 days now. I ...
2
votes
0answers
576 views

Passing a field_id argument to a contextual filter in a Views block display

I'm editing/rewriting this question since I've made a bit more progress on it since I first posted it, and now the questions I have about what I'm trying to do are more specific: I have a content ...
2
votes
1answer
244 views

Context reaction : Exclude specific block?

I've got a website with 3 large contexts : - internet - intranet - shop These 3 contexts are "tight" (sorry about my english, I think this is the word). My Block UI (admin/build/block) provides to ...
2
votes
0answers
1k views

Callback with node ID in Quick Tabs

I am planning to use Quick tabs, and it has one neat feature to use a menu as a callback and it prints the content returned from it. But How can I use the callback to pass NID so that I can return ...
2
votes
0answers
409 views

hook_quicktabs_alter() is not called when using two quickstabs on the same page

I have embedded a second quicktab on page, which is called from the first quicktab (using qtabs as tab type). The function hook_quicktabs_alter() is only called for the first quicktab, not for the ...
2
votes
1answer
393 views

Saving form data and running custom queries in mysql

I'm new to drupal and although I've researched and asked some questions I'm still stuck on how I can achieve my end result. I have built a php/html/mysql website (www.gbpokerclub.co.uk) but I now want ...
2
votes
0answers
70 views

Extra menu_block showing on one page only

I have a single page that is rendering an additional menu_block that repeats my sub-navigation link (which are displayed in a side column). I have a Primary Link in the main navigation that has two ...
2
votes
0answers
79 views

Blocks appearing inside the Content Nodes(Article)

I have added two blocks in my content page such as Most Popular block and Related Contents. I have also arranged these blocks to be appear in the lower in the Content section inside the Blocks. But, ...
2
votes
0answers
373 views

Problem with theme registry rebuild and drupal_get_form in a block

I'm calling a form from a custom block and having real problems getting it to function with theme registry rebuild on each page load turned off. With the registry rebuilding every page load this ...
2
votes
0answers
36 views

How to trace menu links not linked to a node in views

I am using drupal 7.18 + views 7.x-3.5 + menu node views 7.x.1 I managed to make blocks of the children of the active menu item, using views and menu node views based on the menu node id contextual ...
2
votes
4answers
1k views

How to create custom theme a view

I've defined a view with the CCK and Views modules. I have two ways for printing the result: As node content As fields content If I choose node content, I need to choose the view mode, which by ...
2
votes
2answers
71 views

Can I run 2 active polls on my site?

We have a regular poll on our homepage, which I set up by selecting 'most recent poll'. However, I want to add a different poll on a seperate page on my website. Can I do this? I can't find polls as ...
2
votes
1answer
240 views

How to add links to sidebar without using a block?

does anyone know how to add links or HTML onto the left sidebar of a drupal theme without using a block? I am using drupal 7.14. Any help would be appreciated.
2
votes
1answer
2k views

Quicktab problem on the argument of view and block

I used to make a view shows a page of a project in the url: projects/[node:author]/[node:nid], this view works well. Now I want to display this view in the quicktab, but the problem is I can't view ...
2
votes
0answers
240 views

Ajaxify quicktabs does not work when views have contextual filters

I have 4 views and i have made them into tabs using quicktabs and it works fine. But when i try to load then through ajax starting from second views nothing loads.I have some contextual filters in all ...
2
votes
1answer
122 views

Inherit areas of parent or ancestor page

I have a website built with Drupal 7. Each page on the site can have an infinite number of child pages. Each page has "areas"; an area can be a thing such as left or right side bars that contain ...