You are here

public function TBMegaMenuBuilder::isBlockContentEmpty in The Better Mega Menu 8

Same name and namespace in other branches
  1. 2.x src/TBMegaMenuBuilder.php \Drupal\tb_megamenu\TBMegaMenuBuilder::isBlockContentEmpty()

Test if a block has content or not.

Parameters

string $block_id: The block id.

string $section: The menu section.

Return value

bool True if empty.

Overrides TBMegaMenuBuilderInterface::isBlockContentEmpty

1 call to TBMegaMenuBuilder::isBlockContentEmpty()
TBMegaMenuBuilder::syncBlock in src/TBMegaMenuBuilder.php
Sync a core block with the TB config.

File

src/TBMegaMenuBuilder.php, line 503

Class

TBMegaMenuBuilder
Defines a TBMegaMenuBuilder.

Namespace

Drupal\tb_megamenu

Code

public function isBlockContentEmpty(string $block_id, string $section) {
  $entity_block = self::loadEntityBlock($block_id);
  if ($entity_block && ($entity_block
    ->getPlugin()
    ->build() || $section == 'backend')) {
    return TRUE;
  }
  return FALSE;
}