SHARE
TWEET

Untitled

a guest Jun 18th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function mytheme_preprocess_views_view($variables) {
  2.   if($variables['id'] == 'myview_id') {
  3.     use DrupalCorePluginPluginBase;
  4.  
  5.     $facet_id = 'facet_type';
  6.     $render = [];
  7.     $block_manager = Drupal::service('plugin.manager.block');
  8.     $config = [];
  9.     $block_plugin = $block_manager->createInstance('facet_block' . PluginBase::DERIVATIVE_SEPARATOR . $facet_id, $config);
  10.     if ($block_plugin) {
  11.       $access_result = $block_plugin->access(Drupal::currentUser());
  12.     if ($access_result) {
  13.       $render = $block_plugin->build();
  14.     }
  15.   }
  16.   if (!empty($render)) {
  17.     $variables[$facet_id] = [
  18.       'title' => 'Type',
  19.       'render' => $render,
  20.     ];
  21.   }
  22. }
  23.      
  24. {{ facet_type }}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top