Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

0

So the way that I ended up fixing this, was to use Twig Tweak to output the content block directly, like so: {{ drupal_entity('block_content', content_block_id) }} This ends up bypassing Drupal cache. Barring a better fix, this is the one I'm going with.


0

You have to rewrite $value = $block_content->get('field_link')->getValue()[0]; to something like this: $value = $block_content->get('field_link')->first()->getUrl()->toString(); See What is the correct way to get the link url?


3

Considering the first option, it is simple : add a contextual filter of type "ID: Content" with the following configuration : WHEN THE FILTER VALUE IS NOT AVAILABLE > provide a default value > content id from url Go all the way down in the "more" section, expand it and check "exclude". Then click apply And save the views That's it !


2

The problem was me creating a document block above the class, creating an interference between the class and annotation. Another lesson learned the hard way.


0

I am the maintainer of Charts, and it's definitely designed for plotting data stored in your database. I recommend using Views. This is a good tutorial: https://www.ostraining.com/blog/drupal/create-charts-with-views/ [The documentation page on Drupal.org seems to have some broken link issues - I will work to fix this]. If you want to plot data in a non-...


0

If you've created the block as a View you can use views_embed_view in your template_preprocess_page function, something like: $variables['my_block'] = views_embed_view('view_machine_name', 'block_machine_name'); Sub in the View and block machine names. View name visible at admin/structure/views and the block machine name on the specific block's Advanced ...


0

Cache Control Override plugin intends to solve the problem with an anonymous user cache control. After installation, both methods will work: return array( '#markup' => date("Y-m-d H:i:s"), '#cache' => array('max-age' => 10). ); or public function getCacheMaxAge() { return 10; }


0

Easiest way is hook_block_view_alter this hook will give you ability to override output of any block. you can set condition based on user login like : function mymodule_block_view_alter(&$data, $block) { if($block->bid == 41){ if($user->uid == 0){ $body = "your design without login"; $data["content"] = $body; }else{ $...


0

I encountered this myself, using modules or patches did not work for me. Doing the Database fix route, thinking this has something to do with UUIDs or IDs. Everything seems fine. What worked for me to fix this is to modify the block_content_field_data table and made sure all the existing blocks for the field reusable is not NULL Then do a cache clear for ...


0

I think there is no way to get the the view Object directly it's protected property and there is no method to get it: From ViewsBlockBase /** * The View executable object. * * @var \Drupal\views\ViewExecutable */ protected $view; But there is a way first get the view id from the DerivativeId and then load the view here is a code ...


Top 50 recent answers are included