New answers tagged

0

Does it work when you don't limit? And just to be double sure.... you have got to Structure > Block Layout > Types > (actual type) > Manage Display. And once there, in the bottom area where it says "Layout for basic in default", you selected a "Select a layout" of something other than "-None-". Because the fields won't show until you select a Display ...


0

You can 'hide the title' field from the display and afterwards create a php field. The php field can reference the title field if it is declared higher in the list than the php block and then you can use php for your condition.


0

Views module comes with the field Has new content that outputs New or Updated depending on the status of the node as being viewed by a visitor. Anonymous visitors don't see anything because there is no history record about that users visits to a particular node. Authenticated users will see the word New if they never visited that node. If they have ...


1

You can use the table theme type to do this. In your build section, return a render array that includes this: return [ '#type' => 'table', '#header' => $header, '#rows' => $rows, ]; Where header is an array of strings and rows is an array of row value arrays. Some reference items I found: New render element #type 'table' Render arrays


0

Given the answer you mentioned, I assume that you would like to retrieve your items data programmatically. What you are missing is the setRoot() method from MenuTreeParameters (here). Here is how you could start with: $menuTree = \Drupal::menuTree(); $menuTreeParameters = new MenuTreeParameters(); // This will fetch the tree starting from ...


0

You can do this by configuring the Menu levels on your Menu Block and placing that Block in a region of your theme. Additionally configure the Visibility of the block so it only appears on pages where you want it. You can learn more about the Menu levels configuration here: Drupal 8 Navigation Menu Blocks configuration. In your case you want the Initial ...


-1

It's been a while since this question has been asked, but in case someone searches for a solution for this problem and ends up here (like I did): You can add the iframe-Tag to the Xss whitelist: Open the file core/lib/Drupal/Component/Utility/Xss.php Add 'iframe' to the $adminTags array After refreshing the cache, iframe-Tags will no longer be stripped ...


0

You invoke hook_preprocess_username() by rendering the template username. Since D8 has no longer a theme() function the only way to do this is by putting the template in #theme of a render array. In your case multiple times: public function build() { $build = []; foreach ($usersFromQuery as $user) { $build[] = [ '#theme' => 'username', ...


0

Try adding the template array key to your theme hook: function footer_block_theme($existing, $type, $theme, $path){ return [ 'footer_menu' => [ 'variables' => [ 'address_title' => '', 'address_content' => '', ], 'template' => 'footer-menu', ], ]; } Or try adding the block twig template suggestion ...


0

use Drupal\block_content\Entity\BlockContent; ... function my_block_hooks_block_content_view_alter(array &$build, BlockContent $custom_block) { drupal_set_message(FUNCTION . "() id: " . $custom_block->id() ); } You will get your block id here, based on that set condition and override that specific block output. use Drupal\block_content\Entity\...


Top 50 recent answers are included