You are here

public function TBMegaMenuBuilder::syncBlock in The Better Mega Menu 2.x

Same name and namespace in other branches
  1. 8 src/TBMegaMenuBuilder.php \Drupal\tb_megamenu\TBMegaMenuBuilder::syncBlock()

Sync a core block with the TB config.

Parameters

array $tb_item: The individual menu item.

int|string $row_delta: The delta for the current row.

int|string $col_delta: The delta for the current column.

int|string $item_delta: The delta for the current item.

string $section: The portion of the configuration to sync.

array $item_config: The current configuration for all items.

Overrides TBMegaMenuBuilderInterface::syncBlock

1 call to TBMegaMenuBuilder::syncBlock()
TBMegaMenuBuilder::syncConfig in src/TBMegaMenuBuilder.php
Populate the item_config values.

File

src/TBMegaMenuBuilder.php, line 402

Class

TBMegaMenuBuilder
Defines a TBMegaMenuBuilder.

Namespace

Drupal\tb_megamenu

Code

public function syncBlock(array $tb_item, $row_delta, $col_delta, $item_delta, string $section, array &$item_config) {
  if (!self::isBlockContentEmpty($tb_item['block_id'], $section)) {
    unset($item_config['rows_content'][$row_delta][$col_delta]['col_content'][$item_delta]);
    if (empty($item_config['rows_content'][$row_delta][$col_delta]['col_content'])) {
      unset($item_config['rows_content'][$row_delta][$col_delta]);
    }
    if (empty($item_config['rows_content'][$row_delta])) {
      unset($item_config['rows_content'][$row_delta]);
    }
  }
}