/** fuer menu_link_attributes: * svg icons als svg sprite bereitstellen * passendes sprite auswaehlen * svg in page.html.twig */ use Drupal\Component\Render\FormattableMarkup; /** * Implements theme_preprocess_menu(). */ function swiftly_preprocess_menu(&$variables, $hook) { foreach ($variables['items'] as &$item) { $attributes = $item['url']->getOption('attributes'); if (isset($attributes['data-icon'])) { $title = new FormattableMarkup('
', [ '@title' => $item['title'], '@icon' => $attributes['data-icon'], ]); $item['title'] = $title; } } }