From 22c79687fa9e8819cd859df1abbb453d17a1e09e Mon Sep 17 00:00:00 2001 From: stefanbutura <stefanbutura@3535177.no-reply.drupal.org> Date: Tue, 6 Feb 2018 11:26:18 +0100 Subject: [PATCH] Issue #2937999 by stefan.butura: Integration with menu_link_attributes (does not preserve attributes) --- src/Controller/MenuLinksController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Controller/MenuLinksController.php b/src/Controller/MenuLinksController.php index b4ba173..61f9e67 100755 --- a/src/Controller/MenuLinksController.php +++ b/src/Controller/MenuLinksController.php @@ -72,6 +72,7 @@ public function exportMenuLinks(array $form = NULL, FormStateInterface $form_sta 'weight' => $menuLink->weight->getValue()[0]['value'], 'langcode' => $menuLink->langcode->getValue()[0]['value'], 'uuid' => $menuLink->uuid(), + 'attributes' => !empty($menuLink->link->getValue()[0]['options']['attributes']) ? $menuLink->link->getValue()[0]['options']['attributes'] : NULL, ]; if (array_key_exists('drush', $form) && $form['drush'] === TRUE) { @@ -299,6 +300,7 @@ public static function importMenuLinksFull($menus, &$context) { 'link' => [ 'uri' => $menuLink['uri'], 'title' => $menuLink['link_title'], + 'options' => !empty($menuLink['attributes']) ? ['attributes' => $menuLink['attributes']] : NULL, ], 'menu_name' => $menuLink['menu_name'], 'expanded' => $menuLink['expanded'] === '1' ? TRUE : FALSE, @@ -385,6 +387,7 @@ public static function importMenuLinksSafe($menus, &$context) { 'link' => [ 'uri' => $menuLink['uri'], 'title' => $menuLink['link_title'], + 'options' => !empty($menuLink['attributes']) ? ['attributes' => $menuLink['attributes']] : NULL, ], 'menu_name' => $menuLink['menu_name'], 'expanded' => $menuLink['expanded'] === '1' ? TRUE : FALSE, @@ -430,6 +433,7 @@ public static function importMenuLinksForce($menus, &$context) { 'link' => [ 'uri' => $menuLink['uri'], 'title' => $menuLink['link_title'], + 'options' => !empty($menuLink['attributes']) ? ['attributes' => $menuLink['attributes']] : NULL, ], 'menu_name' => $menuLink['menu_name'], 'expanded' => $menuLink['expanded'] === '1' ? TRUE : FALSE, -- GitLab