You are here

public static function Helpers::setBlockProcessing in Menu Multilingual 8

Enable menu_multilingual block processing.

2 calls to Helpers::setBlockProcessing()
menu_multilingual_block_view_menu_block_alter in ./menu_multilingual.module
Implements hook_block_view_BASE_BLOCK_ID_alter().
menu_multilingual_block_view_system_menu_block_alter in ./menu_multilingual.module
Implements hook_block_view_BASE_BLOCK_ID_alter().

File

src/Helpers.php, line 16

Class

Helpers
Various functions to assist menu_multilingual block.

Namespace

Drupal\menu_multilingual

Code

public static function setBlockProcessing(&$build) {
  $settings = $build['#configuration'];
  if (!empty($settings['only_translated_labels']) || !empty($settings['only_translated_content'])) {
    $modifier = \Drupal::service('menu_multilingual.modifier');
    $modifier
      ->filterLabels($settings['only_translated_labels']);
    $modifier
      ->filterContent($settings['only_translated_content']);
    $build['#pre_render'][] = [
      $modifier,
      'filterLinksInRenderArray',
    ];
  }
}