Loading src/Plugin/Block/FacetBlock.php +12 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,11 @@ class FacetBlock extends BlockBase implements ContainerFactoryPluginInterface { return []; } // Do not build the facet if the block is being previewed. if ($this->getContextValue('in_preview')) { return []; } // Let the facet_manager build the facets. $build = $this->facetManager->build($facet); Loading Loading @@ -173,4 +178,11 @@ class FacetBlock extends BlockBase implements ContainerFactoryPluginInterface { } } /** * {@inheritdoc} */ public function getPreviewFallbackString() { return $this->t('Placeholder for the "@facet" facet', ['@facet' => $this->getDerivativeId()]); } } src/Plugin/Block/FacetBlockDeriver.php +4 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\facets\Plugin\Block; use Drupal\Component\Plugin\PluginBase; use Drupal\Core\Plugin\Context\ContextDefinition; use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Symfony\Component\DependencyInjection\ContainerInterface; Loading Loading @@ -66,6 +67,9 @@ class FacetBlockDeriver implements ContainerDeriverInterface { 'label' => $this->t('Facet: :facet', [':facet' => $facet->getName()]), 'admin_label' => $facet->getName(), 'description' => $this->t('Facet'), 'context_definitions' => [ 'in_preview' => new ContextDefinition('string', $this->t('In preview'), FALSE), ], ] + $base_plugin_definition; } Loading Loading
src/Plugin/Block/FacetBlock.php +12 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,11 @@ class FacetBlock extends BlockBase implements ContainerFactoryPluginInterface { return []; } // Do not build the facet if the block is being previewed. if ($this->getContextValue('in_preview')) { return []; } // Let the facet_manager build the facets. $build = $this->facetManager->build($facet); Loading Loading @@ -173,4 +178,11 @@ class FacetBlock extends BlockBase implements ContainerFactoryPluginInterface { } } /** * {@inheritdoc} */ public function getPreviewFallbackString() { return $this->t('Placeholder for the "@facet" facet', ['@facet' => $this->getDerivativeId()]); } }
src/Plugin/Block/FacetBlockDeriver.php +4 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\facets\Plugin\Block; use Drupal\Component\Plugin\PluginBase; use Drupal\Core\Plugin\Context\ContextDefinition; use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Symfony\Component\DependencyInjection\ContainerInterface; Loading Loading @@ -66,6 +67,9 @@ class FacetBlockDeriver implements ContainerDeriverInterface { 'label' => $this->t('Facet: :facet', [':facet' => $facet->getName()]), 'admin_label' => $facet->getName(), 'description' => $this->t('Facet'), 'context_definitions' => [ 'in_preview' => new ContextDefinition('string', $this->t('In preview'), FALSE), ], ] + $base_plugin_definition; } Loading