Browse Source

Do not display wrapper for empty blocks

merge-requests/4/head 8.x-2.3
Chi 6 years ago
parent
commit
327acbff49
  1. 3
      src/TwigExtension.php

3
src/TwigExtension.php

@ -6,7 +6,6 @@ use Drupal\Component\Utility\Unicode;
use Drupal\Component\Uuid\Uuid; use Drupal\Component\Uuid\Uuid;
use Drupal\Core\Block\BlockPluginInterface; use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Block\TitleBlockPluginInterface; use Drupal\Core\Block\TitleBlockPluginInterface;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemListInterface;
@ -137,7 +136,7 @@ class TwigExtension extends \Twig_Extension {
$build['#cache']['contexts'][] = 'url'; $build['#cache']['contexts'][] = 'url';
} }
if ($wrapper) { if ($wrapper && !Element::isEmpty($build['content'])) {
$build += [ $build += [
'#theme' => 'block', '#theme' => 'block',
'#attributes' => [], '#attributes' => [],

Loading…
Cancel
Save