public function MenuMultilingualLinkTreeModifier::filterLinksInRenderArray in Menu Multilingual 8
Pass menu links from render array of the block to the filter method.
Parameters
array $build: The block render-able array.
Return value
array The modified render-able array.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
File
- src/
Menu/ MenuMultilingualLinkTreeModifier.php, line 132
Class
- MenuMultilingualLinkTreeModifier
- Class MenuMultilingualLinkTreeModifier.
Namespace
Drupal\menu_multilingual\MenuCode
public function filterLinksInRenderArray(array $build) {
$tree =& $build['content']['#items'];
if (!is_array($tree)) {
return $build;
}
$tree = $this
->filtersLinks($tree);
// Hide block if there are no menu items.
if (empty($tree)) {
$build = [
'#markup' => '',
'#cache' => $build['#cache'],
];
}
return $build;
}