The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

1

You can use : $build['test'] = [ '#children' => $test_code, ];


1

I don't think you've thought this through. The standard login page (/user/login) only shows the login form when a user is not yet logged in. So if you want the ability for admin users to see the usual options on that page, you will need to show them to all users -- since you don't know whether or not the user is an admin before they log in. If a user is ...


0

So as Leigh suggested I send this data values into a twig file public function build() { $build = [ '#theme' => 'curatorio_io', '#id' => uniqid(), '#feed_id' => $this->configuration['feed_id'], '#widget_type' => $this->configuration['widget_type'], '#attached' => [ 'library' => [ ...


1

When placing the block, you can set the block visibility conditions. To get a block to show up only on the home page, you would set <front> and Show for the listed pages under the pages visibility section.


0

The block widths are most likely controled by the theme CSS and it seems each block is given a third of the width of the container. To change that and make one block take up two thirds of the container width you have to override the theme CSS. Exactly which selector and declarations to use depends on your particular case. You enter your overrides in the ...


1

try to follow best practises: as no need to render anything on your get the twig template as drupal core handles this. module structure: mymodule mymodule.module mymodule.info.yml mymodule.libraries.yml templates (dir) -- templates/accesscode.html.twig src (dir) -- src/Plugin/Block ----- AccessCode.php in mymodule.module /** * Implements hook_theme()....


1

You can just go to "Structure > block layout" from the admin bar. This will default to your current default theme but along the top of that page it will list out all other active themes and "Seven" will be one of them Click that and the block listing will now be for the Seven theme and you can add/remove blocks like you can normally except it will now be ...


1

Another simpler option is to use the hook_panels_ipe_blocks_alter() hook in a custom module of yours and apply the necessary logic. An example is documented in panels_ipe.api.php: function hook_panels_ipe_blocks_alter(array &$blocks, PanelsDisplayVariant $panels_display) { // Only show blocks that were provided by the 'mymodule' module. foreach ($...


1

The addtoany_block is not a block content, but it's a plugin block. So if you want to get the its build programmatically you should: 1. Get the block configuration (addtoany_block settings). 2. Create an instance of the block. 3. Get the build. Try the following: // Block manager. $block_manager = \Drupal::service('plugin.manager.block'); // Load Block ...


0

Create a custom module and use this code. Make sure to comment out kpr() functions ... they are only here to help inspect what blocks appear and conditions in the current node. function mymodule_block_list_alter(&$blocks) { foreach($blocks as $bid){ kpr($bid); // Enable module Devel - identify the block you want to remove switch ($bid->...


Top 50 recent answers are included