Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mytheme_preprocess_views_view($variables) {
- if($variables['id'] == 'myview_id') {
- use DrupalCorePluginPluginBase;
- $facet_id = 'facet_type';
- $render = [];
- $block_manager = Drupal::service('plugin.manager.block');
- $config = [];
- $block_plugin = $block_manager->createInstance('facet_block' . PluginBase::DERIVATIVE_SEPARATOR . $facet_id, $config);
- if ($block_plugin) {
- $access_result = $block_plugin->access(Drupal::currentUser());
- if ($access_result) {
- $render = $block_plugin->build();
- }
- }
- if (!empty($render)) {
- $variables[$facet_id] = [
- 'title' => 'Type',
- 'render' => $render,
- ];
- }
- }
- {{ facet_type }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement